-
I was wondering if anyone could tell me how to make a symbol rotate in reference to the mouse position.
I know the follow_mouse code, but i am trying to make a dial that points to the mouse position, where ever it goes.
Hope someone can help. Thanks.
-
Make your dial an MC, and make sure it points to the right by default. Place this script inside the clip's actions:
Code:
onClipEvent(load){
X = this._x;
Y = this._y;
}
onClipEvent(mouseMove){
Xm = _root._xmouse;
Ym = _root._ymouse;
Xdiff = Xm - X;
Ydiff = Ym - Y;
radAngle = Math.atan2(Ydiff , Xdiff);
this._rotation = radAngle*360/(2*Math.PI);
updateAfterEvent();
}
Hope this helps.
-
thanks I will try it out.
-
well that didnt seems to work. The MC spun around the mouse and i could not move the mouse on top of it.
Is there a way to make the dial spin in its place in reference to the mouse?
-
Did you place the dial in the center of the MC?
-
Yeah, that works well, Thanks pmineault!
-
yeah. thanks!
I guess centering it would help.
thanks again.
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
|