Cache#getImage()

getImage(key, full) → {Image}

Gets a Image object from the cache. This returns a DOM Image object, not a Phaser.Image object.

The object is looked-up based on the key given.

Note: If the object cannot be found a console.warn message is displayed.

Only the Image cache is searched, which covers images loaded via Loader.image, Sprite Sheets and Texture Atlases.

If you need the image used by a bitmap font or similar then please use those respective 'get' methods.

Parameters
Name Type Argument Default Description
key string <optional>

The key of the asset to retrieve from the cache. If not given or null it will return a default image. If given but not found in the cache it will throw a warning and return the missing image.

full boolean <optional>
false

If true the full image object will be returned, if false just the HTML Image object is returned.

Returns
Image -

The Image object if found in the Cache, otherwise null. If full was true then a JavaScript object is returned.

Source code: loader/Cache.js (Line 1078)
doc_phaser
2017-02-14 10:40:16
Comments
Leave a Comment

Please login to continue.