public getAttribute
Gets data details from this asset.
public getData
Gets the asset data.
public getLoadStrategy
Gets the strategy class used for loading.
public getSource
Returns the source location path of this asset.
public getState
Returns the state of this asset.
public getType
Get the type of this asset.
public isAttribute
Checks for existance of a data detail on this asset.
public isReady
Checks to see if the data has been loaded on this asset.
public load
Loads the asset data.
Use onDataChange hook method to get notified when data has
finished loading.
public onDataChange
Invoked when data changes.
Must be prepared to handle null.
public onError
Invoked when there was an error while loading asset data.
Note: Prior usage was a hook function. Now this should be treated as a protected method, however TypeScript doesn't have "friend" class support, and AssetLoader needs to invoke this method.
Use
on(AssetEvents.ERROR)
OR
load().catch((error) => { ... })
to receive the error instead.
public hook onStateChange
Invoked when state changes.
Possible values:
- AssetState.NOT_LOADED
- AssetState.LOADING
- AssetState.LOADED
public removeAttribute
Removes a data attribute from this asset.
public setAttribute
Sets data details for this asset.
public setData
Sets the data for this asset.
public setLoadStrategy
Sets the strategy class to be used for loading
public setSource
Sets the source location path of this asset.
This will clear the associated data, and set this asset in the
NOT_LOADED state.
public setState
Sets the state of this asset.
Unloads the asset data
Generated using TypeDoc
public constructor Asset
Represents an asset to a game.