Package | starling.assets |
Class | public class BitmapTextureFactory |
Inheritance | BitmapTextureFactory AssetFactory Object |
Method | Defined By | ||
---|---|---|---|
Creates a new instance. | BitmapTextureFactory | ||
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. | BitmapTextureFactory | ||
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. | BitmapTextureFactory | ||
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 |
Method | Defined By | ||
---|---|---|---|
createBitmapDataFromByteArray(data:ByteArray, onComplete:Function, onError:Function):void Called by 'create' to convert a ByteArray to a BitmapData. | BitmapTextureFactory |
BitmapTextureFactory | () | Constructor |
public function BitmapTextureFactory()
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 |
createBitmapDataFromByteArray | () | method |
protected function createBitmapDataFromByteArray(data:ByteArray, onComplete:Function, onError:Function):void
Called by 'create' to convert a ByteArray to a BitmapData.
Parameters
data:ByteArray — A ByteArray that contains image data
(like the contents of a PNG or JPG file).
| |
onComplete:Function — Called with the BitmapData when successful.
function(bitmapData:BitmapData):void; | |
onError:Function — To be called when creation fails for some reason.
function(error:String):void |