views:

1038

answers:

1

Hello,

How can I calculate the angle of a point the Y-axis (say, the Y position of a MovieClip) with the mouse pointer location in Actionscript 3?

Many thnx!

+4  A: 

I think you mean the angle between a point and the mouse pointer. If that is correct then it would probably be something like this

var distanceX : Number = mouseX - point.x;
var distanceY : Number = mouseY - point.y;
var angleInRadians : Number = Math.atan2(distanceY, distanceX);
var andleInDegrees : Number = angleInRadians * (180 / Math.PI);
James Hay