A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: follow mouse code...?

  1. #1
    Member
    Join Date
    Jun 2001
    Posts
    30
    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.

  2. #2
    Aquarium drinker
    Join Date
    Nov 2000
    Location
    Greater than 45 degrees in Minkowski space
    Posts
    571
    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.

  3. #3
    Member
    Join Date
    Jun 2001
    Posts
    30
    thanks I will try it out.

  4. #4
    Member
    Join Date
    Jun 2001
    Posts
    30
    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?

  5. #5
    Aquarium drinker
    Join Date
    Nov 2000
    Location
    Greater than 45 degrees in Minkowski space
    Posts
    571
    Did you place the dial in the center of the MC?

  6. #6
    Junior Member
    Join Date
    Nov 2000
    Posts
    16
    Yeah, that works well, Thanks pmineault!

  7. #7
    Member
    Join Date
    Jun 2001
    Posts
    30
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center