| Package | dragonBones |
| Class | public class Armature |
| Inheritance | Armature flash.events.EventDispatcher |
| Implements | IAnimatable |
See also
| Property | Defined By | ||
|---|---|---|---|
| animation : Animation [read-only]
An Animation instance
| Armature | ||
| colorTransform : ColorTransform
The ColorTransform instance assiociated with this instance. | Armature | ||
| display : Object [read-only]
Instance type of this object varies from flash.display.DisplayObject to startling.display.DisplayObject and subclasses. | Armature | ||
| name : String
The name of the Armature. | Armature | ||
| userData : Object
An object containing user data. | Armature | ||
| Method | Defined By | ||
|---|---|---|---|
Armature(display:Object)
Creates a Armature blank instance. | Armature | ||
Add a Bone instance to this Armature instance. | Armature | ||
advanceTime(passedTime:Number):void
Update the animation using this method typically in an ENTERFRAME Event or with a Timer. | Armature | ||
dispose():void
Cleans up resources used by this Armature instance. | Armature | ||
Retreives a Bone by name
| Armature | ||
getBoneByDisplay(display:Object):Bone
Gets the Bone assiociated with this DisplayObject. | Armature | ||
Get all Bone instance assiociated with this armature. | Armature | ||
removeBone(bone:Bone):void
Remove a Bone instance from this Armature instance. | Armature | ||
removeBoneByName(boneName:String):void
Remove a Bone instance from this Armature instance. | Armature | ||
updateBonesZ():void
Update the z-order of the display. | Armature | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when a bone of the armature enters a frame. | Armature | |||
| Dispatched when the playback of a animation stops. | Armature | |||
| Dispatched when the playback of a animation completes a loop. | Armature | |||
| Dispatched when the movement of animation is changed. | Armature | |||
| Dispatched when the animation of the armature enter a frame. | Armature | |||
| Dispatched when the playback of a animation starts. | Armature | |||
| animation | property |
animation:Animation [read-only] An Animation instance
public function get animation():AnimationSee also
| colorTransform | property |
colorTransform:ColorTransformThe ColorTransform instance assiociated with this instance.
public function get colorTransform():ColorTransform public function set colorTransform(value:ColorTransform):void| display | property |
display:Object [read-only] Instance type of this object varies from flash.display.DisplayObject to startling.display.DisplayObject and subclasses.
public function get display():Object| name | property |
public var name:StringThe name of the Armature.
| userData | property |
public var userData:ObjectAn object containing user data.
| Armature | () | Constructor |
public function Armature(display:Object)Creates a Armature blank instance.
Parametersdisplay:Object — type of this object varies from flash.display.DisplayObject to startling.display.DisplayObject and subclasses.
|
| addBone | () | method |
public function addBone(bone:Bone, parentName:String = null):voidAdd a Bone instance to this Armature instance.
Parameters
bone:Bone — Bone instance
| |
parentName:String (default = null) — The parent's name of this Bone instance.
|
See also
| advanceTime | () | method |
public function advanceTime(passedTime:Number):voidUpdate the animation using this method typically in an ENTERFRAME Event or with a Timer.
Parameters
passedTime:Number — amount of second to move the playhead ahead.
|
| dispose | () | method |
public function dispose():voidCleans up resources used by this Armature instance.
| getBone | () | method |
public function getBone(name:String):BoneRetreives a Bone by name
Parameters
name:String — name of the Bone to retreive.
|
Bone — A Bone instance or null if no Bone with that name exist.
|
See also
| getBoneByDisplay | () | method |
public function getBoneByDisplay(display:Object):BoneGets the Bone assiociated with this DisplayObject.
Parameters
display:Object — type of this object varies from flash.display.DisplayObject to startling.display.DisplayObject and subclasses.
|
Bone — A bone instance.
|
See also
| getBones | () | method |
public function getBones():Vector.<Bone>Get all Bone instance assiociated with this armature.
ReturnsVector.<Bone> — A Vector.<Bone> instance.
|
See also
| removeBone | () | method |
public function removeBone(bone:Bone):voidRemove a Bone instance from this Armature instance.
Parameters
bone:Bone — Bone instance
|
See also
| removeBoneByName | () | method |
public function removeBoneByName(boneName:String):voidRemove a Bone instance from this Armature instance.
Parameters
boneName:String — name of the Bone instance to remove.
|
See also
| updateBonesZ | () | method |
public function updateBonesZ():voidUpdate the z-order of the display.
| boneFrameEvent | Event |
dragonBones.events.FrameEventDispatched when a bone of the armature enters a frame.
| complete | Event |
dragonBones.events.AnimationEventDispatched when the playback of a animation stops.
| loopComplete | Event |
dragonBones.events.AnimationEventDispatched when the playback of a animation completes a loop.
| movementChange | Event |
dragonBones.events.AnimationEventDispatched when the movement of animation is changed.
| movementFrameEvent | Event |
dragonBones.events.FrameEventDispatched when the animation of the armature enter a frame.
| start | Event |
dragonBones.events.AnimationEventDispatched when the playback of a animation starts.
Download the example files here:
This example builds an Armature instance called "dragon" and stores it into the member varaible called 'armature'.
package
{
import dragonBones.Armature;
import dragonBones.factorys.BaseFactory;
import flash.display.Sprite;
import flash.events.Event;
public class DragonAnimation extends Sprite
{
[Embed(source = "Dragon1.swf", mimeType = "application/octet-stream")]
private static const ResourcesData:Class;
private var factory:BaseFactory;
private var armature:Armature;
public function DragonAnimation()
{
factory = new BaseFactory();
factory.addEventListener(Event.COMPLETE, handleParseData);
factory.parseData(new ResourcesData(), 'Dragon');
}
private function handleParseData(e:Event):void
{
armature = factory.buildArmature('Dragon');
addChild(armature.display as Sprite);
armature.animation.play();
addEventListener(Event.ENTER_FRAME, updateAnimation);
}
private function updateAnimation(e:Event):void
{
armature.advanceTime(1 / stage.frameRate);
}
}
}