Packagestarling.assets
Classpublic class AssetFactoryHelper
InheritanceAssetFactoryHelper Inheritance Object

A helper class that's passed to an AssetFactory's "create" method.



Public Methods
 MethodDefined By
  
addComplementaryAsset(name:String, asset:Object, type:String = null):void
Adds additional assets to the AssetManager.
AssetFactoryHelper
  
addPostProcessor(processor:Function, priority:int = 0):void
Adds a method to be called by the AssetManager when the queue has finished processing.
AssetFactoryHelper
  
executeWhenContextReady(call:Function, ... args):void
Delay the execution of 'call' until it's allowed.
AssetFactoryHelper
  
getExtensionFromUrl(url:String):String
Forwarded to the AssetManager's method with the same name.
AssetFactoryHelper
  
getNameFromUrl(url:String):String
Forwarded to the AssetManager's method with the same name.
AssetFactoryHelper
  
loadDataFromUrl(url:String, onComplete:Function, onError:Function):void
Accesses a URL (local or remote) and passes the loaded ByteArray to the 'onComplete' callback - or executes 'onError' when the data can't be loaded.
AssetFactoryHelper
  
log(message:String):void
Forwarded to the AssetManager's method with the same name.
AssetFactoryHelper
  
Textures are required to call this method when they begin their restoration process after a context loss.
AssetFactoryHelper
  
Textures are required to call this method when they have finished their restoration process after a context loss.
AssetFactoryHelper
Method Detail
addComplementaryAsset()method
public function addComplementaryAsset(name:String, asset:Object, type:String = null):void

Adds additional assets to the AssetManager. To be called when the factory creates more than one asset.

Parameters

name:String
 
asset:Object
 
type:String (default = null)

addPostProcessor()method 
public function addPostProcessor(processor:Function, priority:int = 0):void

Adds a method to be called by the AssetManager when the queue has finished processing. Useful e.g. if assets depend on other assets (like an atlas XML depending on the atlas texture).

Parameters

processor:Function — function(manager:AssetManager):void;
 
priority:int (default = 0) — Processors with a higher priority will be called first. The default processor for texture atlases is called with a priority of '100', others with '0'.

executeWhenContextReady()method 
public function executeWhenContextReady(call:Function, ... args):void

Delay the execution of 'call' until it's allowed. (On mobile, the context may not be accessed while the application is in the background.)

Parameters

call:Function
 
... args

getExtensionFromUrl()method 
public function getExtensionFromUrl(url:String):String

Forwarded to the AssetManager's method with the same name.

Parameters

url:String

Returns
String
getNameFromUrl()method 
public function getNameFromUrl(url:String):String

Forwarded to the AssetManager's method with the same name.

Parameters

url:String

Returns
String
loadDataFromUrl()method 
public function loadDataFromUrl(url:String, onComplete:Function, onError:Function):void

Accesses a URL (local or remote) and passes the loaded ByteArray to the 'onComplete' callback - or executes 'onError' when the data can't be loaded.

Parameters

url:String — a string containing an URL.
 
onComplete:Function — function(data:ByteArray, mimeType:String):void;
 
onError:Function — function(error:String):void;

log()method 
public function log(message:String):void

Forwarded to the AssetManager's method with the same name.

Parameters

message:String

onBeginRestore()method 
public function onBeginRestore():void

Textures are required to call this method when they begin their restoration process after a context loss.

onEndRestore()method 
public function onEndRestore():void

Textures are required to call this method when they have finished their restoration process after a context loss.