Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Loader
Phaser.Loader
Source: src/loader/index.js (Line 10)

Classes

Namespace

Members

<static> FILE_COMPLETE: number
Focus
Focus

Description:

File has finished processing.

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 117)
Focus
Focus
<static> FILE_DESTROYED: number
Focus
Focus

Description:

File has been destroyed

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 126)
Focus
Focus
<static> FILE_ERRORED: number
Focus
Focus

Description:

The File has errored somehow during processing.

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 108)
Focus
Focus
<static> FILE_FAILED: number
Focus
Focus

Description:

File failed to load

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 90)
Focus
Focus
<static> FILE_LOADED: number
Focus
Focus

Description:

File has loaded successfully, awaiting processing

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 81)
Focus
Focus
<static> FILE_LOADING: number
Focus
Focus

Description:

File has been started to load by the loader (onLoad called)

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 72)
Focus
Focus
<static> FILE_PENDING: number
Focus
Focus

Description:

File is in the load queue but not yet started

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 63)
Focus
Focus
<static> FILE_POPULATED: number
Focus
Focus

Description:

File was populated from local data and doesn't need an HTTP request

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 135)
Focus
Focus
<static> FILE_PROCESSING: number
Focus
Focus

Description:

File is being processed (onProcess callback)

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 99)
Focus
Focus
<static> LOADER_COMPLETE: number
Focus
Focus

Description:

The Loader has completed loading and processing.

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 36)
Focus
Focus
<static> LOADER_DESTROYED: number
Focus
Focus

Description:

The Loader has been destroyed.

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 54)
Focus
Focus
<static> LOADER_IDLE: number
Focus
Focus

Description:

The Loader is idle.

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 9)
Focus
Focus
<static> LOADER_LOADING: number
Focus
Focus

Description:

The Loader is actively loading.

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 18)
Focus
Focus
<static> LOADER_PROCESSING: number
Focus
Focus

Description:

The Loader is processing files is has loaded.

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 27)
Focus
Focus
<static> LOADER_SHUTDOWN: number
Focus
Focus

Description:

The Loader is shutting down.

Type:
number
Since: 3.0.0
Source: src/loader/const.js (Line 45)
Focus
Focus

Methods

<static> GetURL(file, baseURL)
Focus
Focus

Description:

Given a File and a baseURL value this returns the URL the File will use to download from.

Parameters:

name type description
file Phaser.Loader.File

The File object.

baseURL string

A default base URL.

Returns:
Description:

The URL the File will use.

Type:
  • string
Examples:
Since: 3.0.0
Source: src/loader/GetURL.js (Line 7)
Focus
Focus
<static> MergeXHRSettings(global, local)
Focus
Focus

Description:

Takes two XHRSettings Objects and creates a new XHRSettings object from them.

The new object is seeded by the values given in the global settings, but any setting in the local object overrides the global ones.

Parameters:

name type description
global Phaser.Types.Loader.XHRSettingsObject

The global XHRSettings object.

local Phaser.Types.Loader.XHRSettingsObject

The local XHRSettings object.

Returns:
Description:

A newly formed XHRSettings object.

Examples:
Since: 3.0.0
Focus
Focus
<static> XHRLoader(file, globalXHRSettings)
Focus
Focus

Description:

Creates a new XMLHttpRequest (xhr) object based on the given File and XHRSettings and starts the download of it. It uses the Files own XHRSettings and merges them with the global XHRSettings object to set the xhr values before download.

Parameters:

name type description
file Phaser.Loader.File

The File to download.

globalXHRSettings Phaser.Types.Loader.XHRSettingsObject

The global XHRSettings object.

Returns:
Description:

The XHR object.

Type:
  • XMLHttpRequest
Examples:
Since: 3.0.0
Source: src/loader/XHRLoader.js (Line 9)
Focus
Focus
<static> XHRSettings([responseType], [async], [user], [password], [timeout], [withCredentials])
Focus
Focus

Description:

Creates an XHRSettings Object with default values.

Parameters:

name type arguments Default description
responseType XMLHttpRequestResponseType <optional> ''

The responseType, such as 'text'.

async boolean <optional> true

Should the XHR request use async or not?

user string <optional> ''

Optional username for the XHR request.

password string <optional> ''

Optional password for the XHR request.

timeout number <optional> 0

Optional XHR timeout value.

withCredentials boolean <optional> false

Optional XHR withCredentials value.

Returns:
Description:

The XHRSettings object as used by the Loader.

Examples:
Since: 3.0.0
Source: src/loader/XHRSettings.js (Line 7)
Focus
Focus