Packagestarling.assets
Classpublic class ByteArrayFactory
InheritanceByteArrayFactory Inheritance AssetFactory Inheritance Object

This AssetFactory forwards ByteArrays to the AssetManager. It's the fallback when no other factory can handle an asset reference (default priority: -100).



Public Properties
 PropertyDefined By
 Inheritedpriority : int
AssetFactory
Public Methods
 MethodDefined By
  
Creates a new instance.
ByteArrayFactory
 Inherited
addExtensions(... args):void
Add one or more file extensions (without leading dot) that identify the supported data types.
AssetFactory
 Inherited
addMimeTypes(... args):void
Add one or more mime types that identify the supported data types.
AssetFactory
  
canHandle(reference:AssetReference):Boolean
[override] Returns 'true' if this factory can handle the given reference.
ByteArrayFactory
  
create(reference:AssetReference, helper:AssetFactoryHelper, onComplete:Function, onError:Function):void
[override] This method will only be called if 'canHandle' returned 'true' for the given reference.
ByteArrayFactory
 Inherited
getExtensions(out:Vector.<String> = null):Vector.<String>
Returns the file extensions this factory supports.
AssetFactory
 Inherited
getMimeTypes(out:Vector.<String> = null):Vector.<String>
Returns the mime types this factory supports.
AssetFactory
Constructor Detail
ByteArrayFactory()Constructor
public function ByteArrayFactory()

Creates a new instance.

Method Detail
canHandle()method
override public function canHandle(reference:AssetReference):Boolean

Returns 'true' if this factory can handle the given reference. The default implementation checks if extension and/or mime type of the reference match those of the factory.

Parameters

reference:AssetReference

Returns
Boolean
create()method 
override public function create(reference:AssetReference, helper:AssetFactoryHelper, onComplete:Function, onError:Function):void

This method will only be called if 'canHandle' returned 'true' for the given reference. It's responsible for creating at least one concrete asset and passing it to 'onComplete'.

Parameters

reference:AssetReference — The asset to be created. If a local or remote URL is referenced, it will already have been loaded, and 'data' will contain a ByteArray.
 
helper:AssetFactoryHelper — Contains useful utility methods to be used by the factory. Look at the class documentation for more information.
 
onComplete:Function — To be called when loading is successful. 'type' parameter is optional.
function(name:String, asset:Object, type:String):void;
 
onError:Function — To be called when creation fails for some reason. Do not call 'onComplete' when that happens.
function(error:String):void