Package | dragonBones.factorys |
Class | public class BaseFactory |
Inheritance | BaseFactory flash.events.EventDispatcher |
Subclasses | StarlingFactory |
Create an instance of the BaseFactory class that way:
import flash.events.Event; import dragonBones.factorys.BaseFactory; [Embed(source = "../assets/Dragon1.swf", mimeType = "application/octet-stream")] private static const ResourcesData:Class; var factory:BaseFactory = new BaseFactory(); factory.addEventListener(Event.COMPLETE, textureCompleteHandler); factory.parseData(new ResourcesData());
See also
Method | Defined By | ||
---|---|---|---|
Create a Basefactory instance. | BaseFactory | ||
addSkeletonData(skeletonData:SkeletonData, name:String = null):void
Add a SkeletonData instance to this BaseFactory instance. | BaseFactory | ||
addTextureAtlas(textureAtlas:Object, name:String = null):void
Add a textureAtlas to this BaseFactory instance. | BaseFactory | ||
buildArmature(armatureName:String, animationName:String = null, skeletonName:String = null, textureAtlasName:String = null):Armature
Build and returns a new Armature instance. | BaseFactory | ||
dispose(disposeData:Boolean = true):void
Cleans up resources used by this BaseFactory instance. | BaseFactory | ||
getSkeletonData(name:String):SkeletonData
Returns a SkeletonData instance. | BaseFactory | ||
getTextureAtlas(name:String):Object
Return the TextureAtlas by that name. | BaseFactory | ||
getTextureDisplay(textureName:String, textureAtlasName:String = null, pivotX:Number, pivotY:Number):Object
Return the TextureDisplay. | BaseFactory | ||
parseData(bytes:ByteArray, skeletonName:String = null):SkeletonData
Parses the raw data and returns a SkeletonData instance. | BaseFactory | ||
removeSkeletonData(name:String):void
Remove a SkeletonData instance from this BaseFactory instance. | BaseFactory | ||
removeTextureAtlas(name:String):void
Remove a textureAtlas from this baseFactory instance. | BaseFactory |
Method | Defined By | ||
---|---|---|---|
generateTextureDisplay(textureAtlas:Object, fullName:String, pivotX:Number, pivotY:Number):Object | BaseFactory |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched after a sucessful call to parseData(). | BaseFactory |
BaseFactory | () | Constructor |
public function BaseFactory()
Create a Basefactory instance.
import dragonBones.factorys.BaseFactory; var factory:BaseFactory = new BaseFactory();
addSkeletonData | () | method |
public function addSkeletonData(skeletonData:SkeletonData, name:String = null):void
Add a SkeletonData instance to this BaseFactory instance.
Parameters
skeletonData:SkeletonData — skeletonData instance.
| |
name:String (default = null ) — A name for this SkeletonData instance.
|
factory.addSkeletonData(skeletondata, 'dragon');
addTextureAtlas | () | method |
public function addTextureAtlas(textureAtlas:Object, name:String = null):void
Add a textureAtlas to this BaseFactory instance.
Parameters
textureAtlas:Object — textureAtlas to add to this BaseFactory instance.
| |
name:String (default = null ) — A name for this TextureAtlas.
|
factory.addTextureAtlas(textureatlas, 'dragon');
buildArmature | () | method |
public function buildArmature(armatureName:String, animationName:String = null, skeletonName:String = null, textureAtlasName:String = null):Armature
Build and returns a new Armature instance.
Parameters
armatureName:String — name of this Armature instance.
| |
animationName:String (default = null ) — name of this animation.
| |
skeletonName:String (default = null ) — name of this skeleton.
| |
textureAtlasName:String (default = null ) — name of this textureAtlas.
|
Armature — A Armature instance.
|
var armature:Armature = factory.buildArmature('dragon');
dispose | () | method |
public function dispose(disposeData:Boolean = true):void
Cleans up resources used by this BaseFactory instance.
Parameters
disposeData:Boolean (default = true ) — Destroy all internal references.
|
factory.dispose();
generateTextureDisplay | () | method |
protected function generateTextureDisplay(textureAtlas:Object, fullName:String, pivotX:Number, pivotY:Number):Object
Parameters
textureAtlas:Object | |
fullName:String | |
pivotX:Number | |
pivotY:Number |
Object |
getSkeletonData | () | method |
public function getSkeletonData(name:String):SkeletonData
Returns a SkeletonData instance.
Parameters
name:String — name of an existing SkeletonData instance.
|
SkeletonData — A SkeletonData instance with given name (if exist).
|
var skeleton:SkeletonData = factory.getSkeletonData('dragon');
getTextureAtlas | () | method |
public function getTextureAtlas(name:String):Object
Return the TextureAtlas by that name.
Parameters
name:String — name of the TextureAtlas to return.
|
Object — A textureAtlas.
|
var atlas:Object = factory.getTextureAtlas('dragon');
getTextureDisplay | () | method |
public function getTextureDisplay(textureName:String, textureAtlasName:String = null, pivotX:Number, pivotY:Number):Object
Return the TextureDisplay.
Parameters
textureName:String — name of this Texture.
| |
textureAtlasName:String (default = null ) — name of the TextureAtlas.
| |
pivotX:Number (default = NaN ) — registration pivotX position.
| |
pivotY:Number (default = NaN ) — registration pivotY position.
|
Object — An Object.
|
var texturedisplay:Object = factory.getTextureDisplay('dragon');
parseData | () | method |
public function parseData(bytes:ByteArray, skeletonName:String = null):SkeletonData
Parses the raw data and returns a SkeletonData instance.
Parameters
bytes:ByteArray — Represents the raw data for the whole skeleton system.
| |
skeletonName:String (default = null ) — (optional) The SkeletonData instance name.
|
SkeletonData — A SkeletonData instance.
|
import flash.events.Event; import dragonBones.factorys.BaseFactory; [Embed(source = "../assets/Dragon1.swf", mimeType = "application/octet-stream")] private static const ResourcesData:Class; var factory:BaseFactory = new BaseFactory(); factory.addEventListener(Event.COMPLETE, textureCompleteHandler); factory.parseData(new ResourcesData());
removeSkeletonData | () | method |
public function removeSkeletonData(name:String):void
Remove a SkeletonData instance from this BaseFactory instance.
Parameters
name:String — name for the SkeletonData instance to remove.
|
factory.removeSkeletonData('dragon');
removeTextureAtlas | () | method |
public function removeTextureAtlas(name:String):void
Remove a textureAtlas from this baseFactory instance.
Parameters
name:String — name of the TextureAtlas to remove.
|
factory.removeTextureAtlas('dragon');
complete | Event |
flash.events.Event
Dispatched after a sucessful call to parseData().