Loader#pack()

pack(key, url, data, callbackContext) → {Phaser.Loader}

Add a JSON resource pack ('packfile') to the Loader.

A packfile is a JSON file that contains a list of assets to the be loaded.
Please see the example 'loader/asset pack' in the Phaser Examples repository.

Packs are always put before the first non-pack file that is not loaded / loading.

This means that all packs added before any loading has started are added to the front
of the file queue, in the order added.

The key must be a unique String. It is used to add the file to the Phaser.Cache upon successful load.

The URL of the packfile can be relative or absolute. If the URL is relative the Loader.baseURL and Loader.path values will be prepended to it.

Parameters
Name Type Argument Default Description
key string

Unique asset key of this resource pack.

url string <optional>

URL of the Asset Pack JSON file. If you wish to pass a json object instead set this to null and pass the object as the data parameter.

data object <optional>

The Asset Pack JSON data. Use this to pass in a json data object rather than loading it from a URL. TODO

callbackContext object <optional>
(loader)

Some Loader operations, like Binary and Script require a context for their callbacks. Pass the context here.

Returns

This Loader instance.

Source code: loader/Loader.js (Line 613)
doc_phaser
2017-02-14 10:54:28
Comments
Leave a Comment

Please login to continue.