Phaser API Documentation

  Version: 
Filter

An Audio Sprite File suitable for loading by the Loader.

These are created when you use the Phaser.Loader.LoaderPlugin#audioSprite method and are not typically created directly.

For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audioSprite.

Constructor:

new AudioSpriteFile(loader, key, jsonURL, [audioURL], [audioConfig], [audioXhrSettings], [jsonXhrSettings])

Parameters:

name type arguments description
loader Phaser.Loader.LoaderPlugin

A reference to the Loader that is responsible for this file.

key string | Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig

The key to use for this file, or a file configuration object.

jsonURL string

The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead.

audioURL Object <optional>

The absolute or relative URL to load the audio file from. If empty it will be obtained by parsing the JSON file.

audioConfig any <optional>

The audio configuration options.

audioXhrSettings Phaser.Types.Loader.XHRSettingsObject <optional>

An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings.

jsonXhrSettings Phaser.Types.Loader.XHRSettingsObject <optional>

An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings.

Since: 3.7.0

Extends


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
Inherited from: Phaser.Loader.MultiFile#baseURL
Since: 3.20.0
Source: src/loader/MultiFile.js (Line 146)
Focus
Focus
complete: boolean
Focus
Focus

Description:

The completion status of this MultiFile.

Type:
boolean
Default: false
Inherited from: Phaser.Loader.MultiFile#complete
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 107)
Focus
Focus
config: any
Focus
Focus

Description:

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

Type:
any
Inherited from: Phaser.Loader.MultiFile#config
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 137)
Focus
Focus
failed: number
Focus
Focus

Description:

The number of files that failed to load.

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

Description:

Array of files that make up this MultiFile.

Type:
Inherited from: Phaser.Loader.MultiFile#files
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 89)
Focus
Focus
key: string
Focus
Focus

Description:

Unique cache key (unique within its file type)

Type:
string
Inherited from: Phaser.Loader.MultiFile#key
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:
Inherited from: Phaser.Loader.MultiFile#loader
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
Inherited from: Phaser.Loader.MultiFile#multiKeyIndex
Since: 3.20.0
Source: src/loader/MultiFile.js (Line 79)
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
Inherited from: Phaser.Loader.MultiFile#path
Since: 3.20.0
Source: src/loader/MultiFile.js (Line 156)
Focus
Focus
pending: number
Focus
Focus

Description:

The number of files to load.

Type:
number
Inherited from: Phaser.Loader.MultiFile#pending
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 117)
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
Inherited from: Phaser.Loader.MultiFile#prefix
Since: 3.20.0
Source: src/loader/MultiFile.js (Line 166)
Focus
Focus
state: number
Focus
Focus

Description:

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

Type:
number
Inherited from: Phaser.Loader.MultiFile#state
Since: 3.60.0
Source: src/loader/MultiFile.js (Line 98)
Focus
Focus
type: string
Focus
Focus

Description:

The file type string for sorting within the Loader.

Type:
string
Inherited from: Phaser.Loader.MultiFile#type
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 54)
Focus
Focus

Methods

addToCache()
Focus
Focus

Description:

Adds this file to its target cache upon successful loading and processing.

Since: 3.7.0
Focus
Focus
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.

Inherited from: Phaser.Loader.MultiFile#addToMultiFile
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 196)
Focus
Focus
destroy()
Focus
Focus

Description:

Destroy this Multi File and any references it holds.

Inherited from: Phaser.Loader.MultiFile#destroy
Since: 3.60.0
Source: src/loader/MultiFile.js (Line 292)
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
Inherited from: Phaser.Loader.MultiFile#isReadyToProcess
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 183)
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.

Overrides: Phaser.Loader.MultiFile#onFileComplete
Since: 3.7.0
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.

Inherited from: Phaser.Loader.MultiFile#onFileFailed
Since: 3.7.0
Source: src/loader/MultiFile.js (Line 237)
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.

Inherited from: Phaser.Loader.MultiFile#pendingDestroy
Since: 3.60.0
Source: src/loader/MultiFile.js (Line 258)
Focus
Focus