I was playing around with IK stuff about a month ago and found a good example in some AS2 code, so I converted it to a couple of classes and updated it to AS3.
Here is what I use as my Document Class:
package {
import flash.display.MovieClip;
public class IKChain extends MovieClip {
protected var numOfNodes:Number = 10;
public function IKChain() {
CreateNodes();
}
protected function CreateNodes():void
{
for (var c = 0; c < numOfNodes; c++)
{
var myNode:Node = new Node(stage.stageWidth, stage.stageHeight, c);
this.addChild(myNode);
}
var firstNode = this.getChildByName("node0");
firstNode.nodes.push(this.getChildByName("node1"));
for ( var b = 1; b < numOfNodes - 1; b++)
{
myNode = Node(this.getChildByName("node" + b));
myNode.nodes.push(this.getChildByName("node" + (b - 1)));
myNode.nodes.push(this.getChildByName("node" + (b + 1)));
}
var lastNode = this.getChildByName("node" + (numOfNodes - 1));
lastNode.nodes.push(this.getChildByName("node" + (numOfNodes - 2)));
firstNode.Move(firstNode, null);
}
}
}
And here is what I refer to as my Node class for each node. You need to link the items you want chained together in your linkage to the Node class:
package {
import flash.display.MovieClip;
public class IKChain extends MovieClip {
protected var numOfNodes:Number = 10;
public function IKChain() {
CreateNodes();
}
protected function CreateNodes():void
{
for (var c = 0; c < numOfNodes; c++)
{
var myNode:Node = new Node(stage.stageWidth, stage.stageHeight, c);
this.addChild(myNode);
}
var firstNode = this.getChildByName("node0");
firstNode.nodes.push(this.getChildByName("node1"));
for ( var b = 1; b < numOfNodes - 1; b++)
{
myNode = Node(this.getChildByName("node" + b));
myNode.nodes.push(this.getChildByName("node" + (b - 1)));
myNode.nodes.push(this.getChildByName("node" + (b + 1)));
}
var lastNode = this.getChildByName("node" + (numOfNodes - 1));
lastNode.nodes.push(this.getChildByName("node" + (numOfNodes - 2)));
firstNode.Move(firstNode, null);
}
}
}
Hope this helps you get a jump start on the idea.