Skip to main content
Version: Phaser v4.0.0

MultiAtlasFile

A Multi Texture Atlas File is a composite file type that loads a Texture Packer multi-atlas JSON file along with all of the texture image files it references. A multi-atlas is useful when your sprite sheet assets are too large to fit into a single texture and have been split across multiple image files, each described by a shared JSON data file. Phaser parses the JSON, then automatically queues and loads each referenced image (and any associated normal maps) before adding the complete atlas to the Texture Manager under a single key.

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

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

Constructor

new MultiAtlasFile(loader, key, [atlasURL], [path], [baseURL], [atlasXhrSettings], [textureXhrSettings])

Parameters

nametypeoptionaldescription
loaderPhaser.Loader.LoaderPluginNoA reference to the Loader that is responsible for this file.
keystring | Phaser.Types.Loader.FileTypes.MultiAtlasFileConfigNoThe key of the file. Must be unique within both the Loader and the Texture Manager. Or a config object.
atlasURLstringYesThe absolute or relative URL to load the multi atlas json file from.
pathstringYesOptional path to use when loading the textures defined in the atlas data.
baseURLstringYesOptional Base URL to use when loading the textures defined in the atlas data.
atlasXhrSettingsPhaser.Types.Loader.XHRSettingsObjectYesExtra XHR Settings specifically for the atlas json file.
textureXhrSettingsPhaser.Types.Loader.XHRSettingsObjectYesExtra XHR Settings specifically for the texture files.

Scope: static

Extends

Phaser.Loader.MultiFile

Source: src/loader/filetypes/MultiAtlasFile.js#L15
Since: 3.7.0

Inherited Methods

From Phaser.Loader.MultiFile:


Public Methods

addToCache

<instance> addToCache()

Description:

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

Source: src/loader/filetypes/MultiAtlasFile.js#L156
Since: 3.7.0


onFileComplete

<instance> onFileComplete(file)

Description:

Called by each File when it finishes loading. When the JSON atlas file completes, this method inspects its textures array and dynamically creates and queues an ImageFile for every texture referenced within it. If any texture entry also defines a normalMap, a linked ImageFile is created for that too. The Loader's baseURL, path, and prefix are temporarily overridden to those specified in the MultiAtlasFile config during this process, then restored afterwards.

Parameters:

nametypeoptionaldescription
filePhaser.Loader.FileNoThe File that has completed processing.

Overrides: Phaser.Loader.MultiFile#onFileComplete

Source: src/loader/filetypes/MultiAtlasFile.js#L79
Since: 3.7.0


Inherited Members

From Phaser.Loader.MultiFile: