Package | starling.assets |
Class | public class ByteArrayFactory |
Inheritance | ByteArrayFactory AssetFactory Object |
Method | Defined By | ||
---|---|---|---|
Creates a new instance. | ByteArrayFactory | ||
addExtensions(... args):void Add one or more file extensions (without leading dot) that identify the supported data
types. | AssetFactory | ||
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 | ||
getExtensions(out:Vector.<String> = null):Vector.<String> Returns the file extensions this factory supports. | AssetFactory | ||
getMimeTypes(out:Vector.<String> = null):Vector.<String> Returns the mime types this factory supports. | AssetFactory |
ByteArrayFactory | () | Constructor |
public function ByteArrayFactory()
Creates a new instance.
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 |
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 |