// Inverse kinematic chain // Set distance var dist:Number = 100; // Create a blank array to hold the positions of all your points var points:Array = new Array(); // Populate the array, you could do this every frame and set each point as a movieClips x and y or whatever you need for (var i:Number = 0; i<3; i++) { points.push([0, 0]); } onEnterFrame = function () { // Make first point = mouse x and y (or whatever you like) points[0][0] = _xmouse; points[0][1] = _ymouse; // Make the first point = a set point points[2][0] = 300; points[2][1] = 300; // Set distances every frame var ang:Number; for (var i:Number = 1; i<=2; i++) { ang = Math.atan2(points[i][1]-points[i-1][1], points[i][0]-points[i-1][0]); points[i][0] = points[i-1][0]+Math.cos(ang)*dist; points[i][1] = points[i-1][1]+Math.sin(ang)*dist; } // Draw lines between points _root.clear(); _root.lineStyle(1, 0xFF0000, 100); _root.moveTo(points[0][0], points[0][1]); for (var i:Number = 1; i<3; i++) { _root.lineTo(points[i][0], points[i][1]); } };