PackagedragonBones
Classpublic class Bone
InheritanceBone Inheritance flash.events.EventDispatcher

A Bone instance represents a single joint in an Armature instance. An Armature instance can be made up of many Bone instances.

View the examples

See also

dragonBones.Bone
dragonBones.animation.Animation


Public Properties
 PropertyDefined By
  armature : Armature
[read-only] The armature this Bone instance belongs to.
Bone
  childArmature : Armature
[read-only] The sub-armature of this Bone instance.
Bone
  colorTransform : ColorTransform
The ColorTransform instance assiociated with this Bone instance.
Bone
  display : Object
The DisplayObject belonging to this Bone instance.
Bone
  displayList : Array
[read-only] The DisplayObject list belonging to this Bone instance.
Bone
  global : BoneTransform
This Bone instance global Node instance.
Bone
  name : String
The name of this Bone instance's Armature instance.
Bone
  node : BoneTransform
This Bone instance Node Instance.
Bone
  origin : BoneTransform
This Bone instance origin Node Instance.
Bone
  parent : Bone
[read-only] Indicates the Bone instance that directly contains this Bone instance if any.
Bone
  userData : Object
An object that can contain any user extra data.
Bone
  visible : Object
Whether this Bone instance and its associated DisplayObject are visible or not (true/false/null).
Bone
Public Methods
 MethodDefined By
  
Bone(displayBrideg:IDisplayBridge)
Creates a new Bone instance and attaches to it a IDisplayBridge instance.
Bone
  
changeDisplayList(displayList:Array):void
Change all DisplayObject attached to this Bone instance.
Bone
  
contains(bone:Bone, deepLevel:Boolean = false):Boolean
Returns true if the passed Bone Instance is a child of this Bone instance (deepLevel false) or true if the passed Bone instance is in the child hierarchy of this Bone instance (deepLevel true) false otherwise.
Bone
  
dispose():void
Cleans up any resources used by this Bone instance.
Bone
Property Detail
armatureproperty
armature:Armature  [read-only]

The armature this Bone instance belongs to.


Implementation
    public function get armature():Armature
childArmatureproperty 
childArmature:Armature  [read-only]

The sub-armature of this Bone instance.


Implementation
    public function get childArmature():Armature
colorTransformproperty 
colorTransform:ColorTransform

The ColorTransform instance assiociated with this Bone instance. null means that the ColorTransform will be controled by animation data.


Implementation
    public function get colorTransform():ColorTransform
    public function set colorTransform(value:ColorTransform):void
displayproperty 
display:Object

The DisplayObject belonging to this Bone instance. Instance type of this object varies from flash.display.DisplayObject to startling.display.DisplayObject and subclasses.


Implementation
    public function get display():Object
    public function set display(value:Object):void
displayListproperty 
displayList:Array  [read-only]

The DisplayObject list belonging to this Bone instance.


Implementation
    public function get displayList():Array
globalproperty 
public var global:BoneTransform

This Bone instance global Node instance.

See also

dragonBones.objects.Node
nameproperty 
public var name:String

The name of this Bone instance's Armature instance.

nodeproperty 
public var node:BoneTransform

This Bone instance Node Instance.

See also

dragonBones.objects.Node
originproperty 
public var origin:BoneTransform

This Bone instance origin Node Instance.

See also

dragonBones.objects.Node
parentproperty 
parent:Bone  [read-only]

Indicates the Bone instance that directly contains this Bone instance if any.


Implementation
    public function get parent():Bone
userDataproperty 
public var userData:Object

An object that can contain any user extra data.

visibleproperty 
visible:Object

Whether this Bone instance and its associated DisplayObject are visible or not (true/false/null). null means that the visible will be controled by animation data.


Implementation
    public function get visible():Object
    public function set visible(value:Object):void
Constructor Detail
Bone()Constructor
public function Bone(displayBrideg:IDisplayBridge)

Creates a new Bone instance and attaches to it a IDisplayBridge instance.

Parameters
displayBrideg:IDisplayBridge
Method Detail
changeDisplayList()method
public function changeDisplayList(displayList:Array):void

Change all DisplayObject attached to this Bone instance.

Parameters

displayList:Array — An array of valid DisplayObject to attach to this Bone.

contains()method 
public function contains(bone:Bone, deepLevel:Boolean = false):Boolean

Returns true if the passed Bone Instance is a child of this Bone instance (deepLevel false) or true if the passed Bone instance is in the child hierarchy of this Bone instance (deepLevel true) false otherwise.

Parameters

bone:Bone — Check against child heirarchy.
 
deepLevel:Boolean (default = false)

Returns
Boolean
dispose()method 
public function dispose():void

Cleans up any resources used by this Bone instance.

Examples

Download the example files here:

This example retrieves the Bone instance assiociated with the character's head and apply to its Display property an 0.5 alpha.

    
     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();
                     var bone:Bone = armature.getBone("head");
                     bone.display.alpha = 0.5;//make the DisplayObject belonging to this bone semi transparent.
                 addEventListener(Event.ENTER_FRAME, updateAnimation);            
             }
             
             private function updateAnimation(e:Event):void 
             {
                 armature.advanceTime(1 / stage.frameRate);
             }        
         }
     }