-
Mouse follower
I am making a flash file that contains a simple circle as a symbol which contains a small dash at the 12 o'clock position. What I want is for the circle to rotate so that the dash always points towards the user's cursor. Is this possible? If so, could anyone help by telling me what ActionScript I need to write!
Thanks!
-
Senior Member
something like this?
Code:
onClipEvent (enterFrame) {
myRadians = Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x);
myDegrees = Math.round((myRadians*180/Math.PI));
this._rotation = myDegrees+90;
}
Your circle with the dash in it will need to be a movie clip, and you simply add this code to it.
Last edited by Cass101; 03-02-2005 at 04:02 PM.
-
Also, make sure the registration point is in the middle of the clock, if you didn't already know that.
PS: I'm pretty sure it has to be... because it rotates around the registration point.
-
Thanks! That worked exactly as I wanted.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|