Follow Cursor Animation
I'm trying to develop code for a single object to rotate on a 2-dimensional axis. I want the object to rotate in the direction that I move the mouse. For example, if my object were an eye - the pupil would watch the cursor move around the screen.
Here is where I'm at:
stage.addEventListener("mouseMove", arjun);
function arjun(e:MouseEvent):void
{
var var1=mouseY - eyeR.y;
var var2=mousex - eyeR.x;
var radiusR=Math.atan2(var1,var2);
var degreeR=radiusR/(Math.Pl/180);
eyeR.rotation=degreeR;
var var1=mouseY - eyeL.y;
var var2=mousex - eyeL.x;
var radiusR=Math.atan2(var1,var2);
var degreeR=radiusR/(Math.Pl/180);
eyeL.rotation=degreeR;
}