Packagestarling.assets
Classpublic class BitmapTextureFactory
InheritanceBitmapTextureFactory Inheritance AssetFactory Inheritance Object

This AssetFactory creates texture assets from bitmaps and image files.



Public Properties
 PropertyDefined By
 Inheritedpriority : int
AssetFactory
Public Methods
 MethodDefined By
  
Creates a new instance.
BitmapTextureFactory
 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.
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
 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
Protected Methods
 MethodDefined By
  
createBitmapDataFromByteArray(data:ByteArray, onComplete:Function, onError:Function):void
Called by 'create' to convert a ByteArray to a BitmapData.
BitmapTextureFactory
Constructor Detail
BitmapTextureFactory()Constructor
public function BitmapTextureFactory()

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

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