Class: MultiFile

Phaser.Loader. MultiFile

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.


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 9)

Members


baseURL :string

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 117)

complete :boolean

The completion status of this MultiFile.

Type:
  • boolean
Since: 3.7.0
Default Value:
  • false
Source: src/loader/MultiFile.js (Line 78)

config :any

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

Type:
  • any
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 108)

failed :integer

The number of files that failed to load.

Type:
  • integer
Since: 3.7.0
Default Value:
  • 0
Source: src/loader/MultiFile.js (Line 98)

files :Array.<Phaser.Loader.File>

Array of files that make up this MultiFile.

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

key :string

Unique cache key (unique within its file type)

Type:
  • string
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 50)

loader :Phaser.Loader.LoaderPlugin

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

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

path :string

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 127)

pending :integer

The number of files to load.

Type:
  • integer
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 88)

prefix :string

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 137)

type :string

The file type string for sorting within the Loader.

Type:
  • string
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 41)

Methods


addToMultiFile(files)

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.

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

This MultiFile instance.

Type
Phaser.Loader.MultiFile

isReadyToProcess()

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

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

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

Type
boolean

onFileComplete(file)

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 190)

onFileFailed(file)

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 208)