Cord phone drag effect

Hi all!

link: http://www.media-ware.net/cord/test04.html

I’ve created this effect when you drag 'n drop the phone, but for some reason that I can’t get right now when you drag it to the left or to the right it takes a lot of time to find its cord.

Can someone please help me out?

I tried using the cords bottom to send the phone’s _x & _y but I didn’t manage it.

Thanks all!

here’s the code used on phone movieclip:

ycord_mc is the cord movieclip and ycordinside_mc is the movieclip inside it.

onClipEvent (load) {
	tx = _x;
	ty = _y;
	tr = 0;
	ch = _parent.ycord_mc.ycordinside_mc._height;
	k = .3;
	damp = .86;
    vx = 0;
    vy = 0;
    vr = 0;
    vc = 0;
} 

onClipEvent (enterFrame) {
	if(!drag){
		ax = (tx - _x) * k;
		ay = (ty - _y)* k;
		ar = (tr - _parent.ycord_mc._rotation) * k;
		ac = (ch - _parent.ycord_mc.ycordinside_mc._height) * k;
		vx += ax;
		vy += ay;
		vr += ar;
		vc += ac;
		vx *= damp;
		vy *= damp;
		vr *= damp;
		vc *= damp;
		_x += vx;
		_y += vy;
		_parent.ycord_mc._rotation += vr;
		_parent.ycord_mc.ycordinside_mc._height += vc;
		//_parent.ycord_mc.ycordinside_mc._height = Math.sqrt(Math.pow((_parent.yphone_mc._y - _parent.ycord_mc._y), 2) + Math.pow((_parent.yphone_mc._x - _parent.ycord_mc._x), 2));
	} else {
		adjside =_parent.yphone_mc._x - _parent.ycord_mc._x;
		oppside = -1*(_parent.yphone_mc._y - _parent.ycord_mc._y);
		
		angle = Math.atan2(oppside, adjside); // in radians
		angle = Math.round(angle/Math.PI*180); // convert to degrees
		_parent.ycord_mc._rotation = -1*(angle) - 90;
		_parent.ycord_mc.ycordinside_mc._height = Math.sqrt(Math.pow((_parent.yphone_mc._y - _parent.ycord_mc._y), 2) + Math.pow((_parent.yphone_mc._x - _parent.ycord_mc._x), 2));
	}
}

on (press) {
	startDrag("");
	drag = true;
}
on (release, releaseOutside) {
	stopDrag();
	drag = false;
}