Phaser API Documentation

  Version: 
Filter

A MultiFile is a special kind of parent that contains two, or more, Files as children and looks after the loading and processing of them all. It is commonly extended and used as a base class for file types such as AtlasJSON or BitmapFont.

You shouldn't create an instance of a MultiFile directly, but should extend it with your own class, setting a custom type and processing methods.

Constructor:

new MultiFile(loader, type, key, files)

Parameters:

name type description
loader Phaser.Loader.LoaderPlugin

The Loader that is going to load this File.

type string

The file type string for sorting within the Loader.

key string

The key of the file within the loader.

files Array.<Phaser.Loader.File>

An array of Files that make-up this MultiFile.

Since: 3.7.0
Source: src/loader/MultiFile.js (Line 11)

Members

baseURL: string
Focus
Focus

Description:

A reference to the Loaders baseURL at the time this MultiFile was created. Used to populate child-files.

Type:
string
Since: 3.20.0
Source: src/loader/MultiFile.js (Line 139)
Focus
Focus
complete: boolean
Focus
Focus

Description:

The completion status of this MultiFile.

Type:
boolean
Default: false
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 100)
Focus
Focus
config: any
Focus
Focus

Description:

A storage container for transient data that the loading files need.

Type:
any
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 130)
Focus
Focus
failed: number
Focus
Focus

Description:

The number of files that failed to load.

Type:
number
Default: 0
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 120)
Focus
Focus
files: Array.<Phaser.Loader.File>
Focus
Focus

Description:

Array of files that make up this MultiFile.

Type:
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 82)
Focus
Focus
key: string
Focus
Focus

Description:

Unique cache key (unique within its file type)

Type:
string
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 63)
Focus
Focus

Description:

A reference to the Loader that is going to load this file.

Type:
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 45)
Focus
Focus
<private> multiKeyIndex: number
Focus
Focus

Description:

The current index being used by multi-file loaders to avoid key clashes.

Type:
number
Since: 3.20.0
Source: src/loader/MultiFile.js (Line 72)
Focus
Focus
path: string
Focus
Focus

Description:

A reference to the Loaders path at the time this MultiFile was created. Used to populate child-files.

Type:
string
Since: 3.20.0
Source: src/loader/MultiFile.js (Line 149)
Focus
Focus
pending: number
Focus
Focus

Description:

The number of files to load.

Type:
number
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 110)
Focus
Focus
prefix: string
Focus
Focus

Description:

A reference to the Loaders prefix at the time this MultiFile was created. Used to populate child-files.

Type:
string
Since: 3.20.0
Source: src/loader/MultiFile.js (Line 159)
Focus
Focus
state: number
Focus
Focus

Description:

The current state of the file. One of the FILE_CONST values.

Type:
number
Since: 3.60.0
Source: src/loader/MultiFile.js (Line 91)
Focus
Focus
type: string
Focus
Focus

Description:

The file type string for sorting within the Loader.

Type:
string
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 54)
Focus
Focus

Methods

addToMultiFile(files)
Focus
Focus

Description:

Adds another child to this MultiFile, increases the pending count and resets the completion status.

Parameters:

name type description
files Phaser.Loader.File

The File to add to this MultiFile.

Returns:
Description:

This MultiFile instance.

Since: 3.7.0
Source: src/loader/MultiFile.js (Line 189)
Focus
Focus
destroy()
Focus
Focus

Description:

Destroy this Multi File and any references it holds.

Since: 3.60.0
Source: src/loader/MultiFile.js (Line 285)
Focus
Focus
isReadyToProcess()
Focus
Focus

Description:

Checks if this MultiFile is ready to process its children or not.

Returns:
Description:

true if all children of this MultiFile have loaded, otherwise false.

Type:
  • boolean
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 176)
Focus
Focus
onFileComplete(file)
Focus
Focus

Description:

Called by each File when it finishes loading.

Parameters:

name type description
file Phaser.Loader.File

The File that has completed processing.

Since: 3.7.0
Source: src/loader/MultiFile.js (Line 212)
Focus
Focus
onFileFailed(file)
Focus
Focus

Description:

Called by each File that fails to load.

Parameters:

name type description
file Phaser.Loader.File

The File that has failed to load.

Since: 3.7.0
Source: src/loader/MultiFile.js (Line 230)
Focus
Focus
pendingDestroy()
Focus
Focus

Description:

Called once all children of this multi file have been added to their caches and is now ready for deletion from the Loader.

It will emit a filecomplete event from the LoaderPlugin.

Since: 3.60.0
Source: src/loader/MultiFile.js (Line 251)
Focus
Focus