Need help with AS3 springs

Hi. Ive been working on this code for some time now, and I cant see whats wrong with it. Here it is:


root.loaderInfo.addEventListener(Event.COMPLETE, finishedload);
var dragging = null;
function finishedload(myevent:Event):void {
 var numFeet:int = 10;
 for (var i=0; i<3; i++) {
  root["foot" + i + "_mc"].addEventListener(MouseEvent.MOUSE_DOWN, dodrag);
  root["foot" + i + "_mc"].addEventListener(MouseEvent.MOUSE_UP, nodrag);
  root["body" + i + "_mc"].addEventListener(MouseEvent.MOUSE_DOWN, dodrag);
  root["body" + i + "_mc"].addEventListener(MouseEvent.MOUSE_UP, nodrag);
 }
 root.addEventListener(Event.ENTER_FRAME, spring);
 //addEventListener(Event.ENTER_FRAME, drawline);
}
function dodrag(myevent:MouseEvent):void {
 myevent.target.startDrag();
 dragging = [myevent.target];
}
function nodrag(myevent:MouseEvent):void {
 myevent.target.stopDrag();
 myevent.target.dragging = false;
 dragging = null;
}
function springfoot(mc1:MovieClip, mc2:MovieClip, radius:Number):void {
 var gravity:int = 6;
 var left:int = 20;
 var right:int = 530;
 var angle;
 var oldx:Number;
 var oldy:Number;
 var targetX:Number;
 var targetY:Number;
 var vy:Number;
 var dy:Number;
 var vx:Number;
 var dx:Number;
 var k:Number = .7;
 var bottom:int = 380;
 var damp:Number = .5;
 if (dragging == [mc1]) {
  vx = mc1.x-oldx;
  vy = mc1.y-oldx;
  oldx = mc1.x;
  oldy = mc1.y;
 } else {
  dx = mc1.x-mc2.x;
  dy = mc1.y-mc2.y;
  angle = Math.atan2(dy, dx);
  targetX = mc2.x+Math.cos(angle)*radius;
  targetY = mc2.y+Math.sin(angle)*radius;
  vx+=(targetX-mc1.x)*k;
  vy+=(targetY-mc1.y)*k;
  vy+=gravity;
  vx*=damp;
  vy*=damp;
  mc1.x+=vx;
  mc1.y+=vy;
  if (mc1.x>right-mc1.width/2) {
   mc1.x = right-mc1.widht/2;
   vx*=-1;
  }
  if (mc1.x<left+mc1.width/2) {
   mc1.x = left+mc1.width/2;
   vx*=-1;
  }
  if (mc1.y>bottom-mc1.height/2) {
   mc1.y = bottom-mc1.height/2;
   vy*=-1;
  }
 }
}
function spring(myevent:Event):void {
 //foot1_mc:
 springfoot(foot1_mc, body0_mc, 100);
 springfoot(foot1_mc, body1_mc, 100);
 springfoot(foot1_mc, body2_mc, 100);
 springfoot(foot1_mc, foot2_mc, 100);
 springfoot(foot1_mc, foot0_mc, 100);
 //body0_mc:
 springfoot(body0_mc, foot1_mc, 100);
 springfoot(body0_mc, foot0_mc, 100);
 springfoot(body0_mc, foot2_mc, 100);
 springfoot(body0_mc, body1_mc, 100);
 springfoot(body0_mc, body2_mc, 100);
 //foot0_mc:
 springfoot(foot0_mc, body0_mc, 100);
 springfoot(foot0_mc, body1_mc, 100);
 springfoot(foot0_mc, body2_mc, 100);
 springfoot(foot0_mc, foot1_mc, 100);
 springfoot(foot0_mc, foot2_mc, 100);
 //foot2_mc:
 springfoot(foot2_mc, body0_mc, 100);
 springfoot(foot2_mc, body1_mc, 100);
 springfoot(foot2_mc, body2_mc, 100);
 springfoot(foot2_mc, foot0_mc, 100);
 springfoot(foot2_mc, foot1_mc, 100);
 //body1_mc:
 springfoot(body1_mc, body0_mc, 100);
 springfoot(body1_mc, body2_mc, 100);
 springfoot(body1_mc, foot0_mc, 100);
 springfoot(body1_mc, foot1_mc, 100);
 springfoot(body1_mc, foot2_mc, 100);
 //body2_mc:
 springfoot(body2_mc, body0_mc, 100);
 springfoot(body2_mc, body1_mc, 100);
 springfoot(body2_mc, foot0_mc, 100);
 springfoot(body2_mc, foot1_mc, 100);
 springfoot(body2_mc, foot2_mc, 100);
}

I know, the bottom function is rather unhandy. I will fix it later.
Well anyway, Ive created six movieclips and named them to work with the code (foot0_mc, foot1_mc, foot2_mc, body0_mc, body1_mc and body2_mc). Now everytime I test it, the balls go to the left top corner. First they dont react at all but when you click them they start reacting on the mouse movements .___.
Id really appreciate if anyone could tell me what was wrong.