fl.ik

# IKArmature - AS3 Flash

Package | fl.ik
Class | public class IKArmature
Inheritance | IKArmature Object

Language Version: | ActionScript 3.0

Product Version: | Flash CS4

Runtime Versions: | Flash Player 10, AIR 1.5

The IKArmature class describes an inverse kinematics (IK) armature. An armature is a collection of segments, called "bones", which are connected to one another at "joints". An armature is often described as a tree-like or chain-like structure. Armatures can take advantage of the spring and damping features of the dynamic physics engine via the `springsEnabled` property.

Because armatures can be created only in the Flash authoring tool, you should not use the IKArmature class's constructor to create instances of this class. Flash Player creates all instances of the IKArmature class when a SWF file starts running. You can create a reference to an armature by using the `getArmatureAt()` or the `getArmatureByName()` methods in the IKManager class.

Note: If an armature is not in the first frame of a scene, use the `registerElements()` method to initialize the armature for a specific DisplayObject.

More examples

Animating IK Armatures Overview

Related API Elements

fl.ik.IKManager.getArmatureAt()
fl.ik.IKManager.getArmatureByName()

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | container : DisplayObjectContainer [read-only] Returns DisplayObjectContainer passed into call to registerElements. | IKArmature
|  | name : String [read-only] The name of the armature. | IKArmature
|  | rootJoint : IKJoint [read-only] The root joint in the armature. | IKArmature
|  | springsEnabled : Boolean Specifies whether springs are enabled for an armature. | IKArmature

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | getBoneByName(targetName:String):IKBone Returns the specified bone. | IKArmature
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | registerElements(container:DisplayObjectContainer):* Activates inverse kinematic (IK) movement for a library symbol instance that contains an armature. | IKArmature
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

### container

property

`container:DisplayObjectContainer` [read-only]

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Returns DisplayObjectContainer passed into call to registerElements.

Implementation
`public function get container():DisplayObjectContainer`

### name

property

`name:String` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Flash CS4

Runtime Versions: | Flash Player 10, AIR 1.5

The name of the armature. The name of an armature can be specified only in the Flash authoring tool.

Implementation
`public function get name():String`
Example ( How to use this example )
The following example shows how to retrieve the name of the first armature in a document:

             import fl.ik.*;
             // Retrieve the first armature and store in variable "arm0"
             var arm0:IKArmature = IKManager.getArmatureAt(0);
             // Trace the name of the first armature
             trace(arm0.name);

Copy

### rootJoint

property

`rootJoint:IKJoint` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Flash CS4

Runtime Versions: | Flash Player 10, AIR 1.5

The root joint in the armature. Each armature contains exactly one root joint, but can have multiple child joints. You can traverse an armature by retrieving the root joint and using methods in the IKJoint class to move from joint to joint.

Implementation
`public function get rootJoint():IKJoint`

Related API Elements

fl.ik.IKJoint
Example ( How to use this example )
The following example shows how to retrieve the first armature in a document and retrieve that armature's root joint:

             import fl.ik.*;
             // Retrieve the first armature and store in variable "arm0"
             var arm0:IKArmature = IKManager.getArmatureAt(0);
             // Retrieve the armature's root joint
             var rootJnt:IKJoint = arm0.rootJoint;

Copy

### springsEnabled

property

`springsEnabled:Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10.1, AIR 1.5

Specifies whether springs are enabled for an armature. When this value is true, the armature can take advantage of the new dynamic physics engine, which adds spring and damping to animation. The default value is true.

Copy

             myArmature:IKArmature = fl.ik.IKManager.getArmatureAt(0);
             myArmature.springsEnabled = true; // turns springs on

Implementation
`public function get springsEnabled():Boolean`
`public function set springsEnabled(value:Boolean):void`
Method Detail

### getBoneByName

()
method

`public function getBoneByName(targetName:String):IKBone`

Language Version: | ActionScript 3.0

Product Version: | Flash CS4

Runtime Versions: | Flash Player 10, AIR 1.5

Returns the specified bone. Each bone can be assigned a name in the Flash authoring tool. Use this method to create a reference to a bone so you can manipulate the bone at run time.

Parameters

| `targetName:String`

Returns

| `IKBone` — An IKBone instance specified by the targetName parameter.

Related API Elements

IKBone class
Example ( How to use this example )
The following example shows how to retrieve a a bone named "firstBone" and assign the bone to a variable named "bone":

             import fl.ik.*;
             // Retrieve bone named "firstBone" and store in variable "bone"
             var bone:IKBone = IKArmature.getBoneByName("firstBone");

Copy

### registerElements

()
method

`public function registerElements(container:DisplayObjectContainer):*`

Language Version: | ActionScript 3.0

Product Version: | Flash CS4

Runtime Versions: | Flash Player 10, AIR 1.5

Activates inverse kinematic (IK) movement for a library symbol instance that contains an armature. A library MovieClip that contains an armature and is instantiated at run time must call this method in order to activate run time inverse kinematic effects.

Note: This method must be called if the armature is not in the first frame of the first scene.

Parameters

| `container:DisplayObjectContainer` — A reference to the stage, accessible through the stage property of any `DisplayObject` that is currently on the display list.

Returns

| `*`

Example ( How to use this example )
The following example shows how to activate inverse kinematic movement to a library symbol that is instantiated at run time. The library symbol is a MovieClip named "IKPerson" that contains an armature.

             import fl.ik.*;
             // Add a Library Symbol named "IKPerson"
             // that contains an armature.
             // The symbol must be marked "Export for ActionScript"
             var myPerson:IKPerson = new IKPerson();

             // add MovieClip to display list
             addChild(myPerson);

             // The IKPerson MovieClip contains an IK Armature with the name
             // "Armature_Person" and marked as Runtime Armature instead of Authortime Armature
             var myArmature:IKArmature = IKManager.getArmatureByName("Armature_Person");

             // Allow armature to perform inverse kinematic
             // movement at run time
             myArmature.registerElements(stage);

             // Allow user to track armature and perform
             // IK movement with the mouse
             IKManager.trackIKArmature(myArmature, true);

Copy

The following example shows how to use the `registerElements()` method to initialize an armature that is not in the first frame of a scene. To initialize an armature, attach the following code to the first frame containing the armature:

             import fl.ik.*;
             var arm:IKArmature = IKManager.getArmatureAt(0);
             arm.registerElements(stage);

Copy

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00