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 | optional | description |
---|---|---|---|
loader | No | A reference to the Loader that is responsible for this file. | |
key | string | Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig | No | The key to use for this file, or a file configuration object. |
jsonURL | string | No | The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead. |
audioURL | Object | Yes | The absolute or relative URL to load the audio file from. If empty it will be obtained by parsing the JSON file. |
audioConfig | any | Yes | The audio configuration options. |
audioXhrSettings | Yes | An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings. | |
jsonXhrSettings | Yes | An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings. |
Scope: static
Extends
Source: src/loader/filetypes/AudioSpriteFile.js#L15
Since: 3.7.0
Public Methods
addToCache
<instance> addToCache()
Description:
Adds this file to its target cache upon successful loading and processing.
Source: src/loader/filetypes/AudioSpriteFile.js#L121
Since: 3.7.0
addToMultiFile
<instance> addToMultiFile(files)
Description:
Adds another child to this MultiFile, increases the pending count and resets the completion status.
Parameters:
name | type | optional | description |
---|---|---|---|
files | No | The File to add to this MultiFile. |
Returns: Phaser.Loader.MultiFile - This MultiFile instance.
Inherits: Phaser.Loader.MultiFile#addToMultiFile
Source: src/loader/MultiFile.js#L196
Since: 3.7.0
destroy
<instance> destroy()
Description:
Destroy this Multi File and any references it holds.
Inherits: Phaser.Loader.MultiFile#destroy
Source: src/loader/MultiFile.js#L292
Since: 3.60.0
isReadyToProcess
<instance> isReadyToProcess()
Description:
Checks if this MultiFile is ready to process its children or not.
Returns: boolean - true
if all children of this MultiFile have loaded, otherwise false
.
Inherits: Phaser.Loader.MultiFile#isReadyToProcess
Source: src/loader/MultiFile.js#L183
Since: 3.7.0
onFileComplete
<instance> onFileComplete(file)
Description:
Called by each File when it finishes loading.
Parameters:
name | type | optional | description |
---|---|---|---|
file | No | The File that has completed processing. |
Overrides: Phaser.Loader.MultiFile#onFileComplete
Source: src/loader/filetypes/AudioSpriteFile.js#L85
Since: 3.7.0
onFileFailed
<instance> onFileFailed(file)
Description:
Called by each File that fails to load.
Parameters:
name | type | optional | description |
---|---|---|---|
file | No | The File that has failed to load. |
Inherits: Phaser.Loader.MultiFile#onFileFailed
Source: src/loader/MultiFile.js#L237
Since: 3.7.0
pendingDestroy
<instance> pendingDestroy()
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.
Fires: Phaser.Loader.Events#event:FILE_COMPLETE, Phaser.Loader.Events#event:FILE_KEY_COMPLETE
Inherits: Phaser.Loader.MultiFile#pendingDestroy
Source: src/loader/MultiFile.js#L258
Since: 3.60.0
Public Members
baseURL
baseURL: string
Description:
A reference to the Loaders baseURL at the time this MultiFile was created. Used to populate child-files.
Inherits: Phaser.Loader.MultiFile#baseURL
Source: src/loader/MultiFile.js#L146
Since: 3.20.0
complete
complete: boolean
Description:
The completion status of this MultiFile.
Inherits: Phaser.Loader.MultiFile#complete
Source: src/loader/MultiFile.js#L107
Since: 3.7.0
config
config: any
Description:
A storage container for transient data that the loading files need.
Inherits: Phaser.Loader.MultiFile#config
Source: src/loader/MultiFile.js#L137
Since: 3.7.0
failed
failed: number
Description:
The number of files that failed to load.
Inherits: Phaser.Loader.MultiFile#failed
Source: src/loader/MultiFile.js#L127
Since: 3.7.0
files
files: Array.<Phaser.Loader.File>
Description:
Array of files that make up this MultiFile.
Inherits: Phaser.Loader.MultiFile#files
Source: src/loader/MultiFile.js#L89
Since: 3.7.0
key
key: string
Description:
Unique cache key (unique within its file type)
Inherits: Phaser.Loader.MultiFile#key
Source: src/loader/MultiFile.js#L63
Since: 3.7.0
loader
loader: Phaser.Loader.LoaderPlugin
Description:
A reference to the Loader that is going to load this file.
Inherits: Phaser.Loader.MultiFile#loader
Source: src/loader/MultiFile.js#L45
Since: 3.7.0
path
path: string
Description:
A reference to the Loaders path at the time this MultiFile was created. Used to populate child-files.
Inherits: Phaser.Loader.MultiFile#path
Source: src/loader/MultiFile.js#L156
Since: 3.20.0
pending
pending: number
Description:
The number of files to load.
Inherits: Phaser.Loader.MultiFile#pending
Source: src/loader/MultiFile.js#L117
Since: 3.7.0
prefix
prefix: string
Description:
A reference to the Loaders prefix at the time this MultiFile was created. Used to populate child-files.
Inherits: Phaser.Loader.MultiFile#prefix
Source: src/loader/MultiFile.js#L166
Since: 3.20.0
state
state: number
Description:
The current state of the file. One of the FILE_CONST values.
Inherits: Phaser.Loader.MultiFile#state
Source: src/loader/MultiFile.js#L98
Since: 3.60.0
type
type: string
Description:
The file type string for sorting within the Loader.
Inherits: Phaser.Loader.MultiFile#type
Source: src/loader/MultiFile.js#L54
Since: 3.7.0
Private Members
multiKeyIndex
multiKeyIndex: number
Description:
The current index being used by multi-file loaders to avoid key clashes.
Access: private
Inherits: Phaser.Loader.MultiFile#multiKeyIndex
Source: src/loader/MultiFile.js#L79
Since: 3.20.0