Help me make this thing follow the mouse

hi, please check this out: here!

I need to make the arrow follow the mouse when I move it throught the bottons, now is moving but with a predetermined move, to be honest I dont have a clue, I searched but no luck, maybe someone can help me or point me out to a tutorial, thanks!

do you want to do it with easing or what?

yes with easing would be great, any ideas? and thanks for replying…

You want this one:

http://www.kirupa.com/developer/mx/followease.htm

Note: the example on the site doesnt’ seem to work in Firefox :frowning: but the code is still the same and works fine.

ok that helped but I dont want to make the arrow follow me around, how can I make that the arrow stays in place and just move like in the example in the first post, in a define area, I dont know if I explained it well…

Oh sorry, what you need is something that eases the needle to the button on rollover. For that you should use Voetsjoeba’s patented easing formula:


 MovieClip.prototype.ease = function(x,y){
   this.onEnterFrame = function(){
     this._x = x-(x-this._x)/1.1;
     this._y = y-(y-this._y)/1.1
       if(this._x > x-1 && this._x < x+1 && this._y > y-1 && this._y < y+1){
            this._x = x;
            this._y = y;
            delete this.onEnterFrame
            //do other stuff here, this is the point at which the object reaches its target
                 }
         }
 }
 MC.ease(100,100);

where MC would be the name of the needle and the coordinates are for the button you want the needle to ease to. Put the AS on the maintimeline but call the function on rollover of your button. Also, instead of hard numbers for the coordinates you can use the _x and _y positions of your button - that way if you ever move the buttons around you don’t have to worry about changing those numbers. Note - if you do it that way you should make your registration point of your button at the center.

Cool nav idea by the way :thumb:

Hope this helps!

:hr:

thanks lunatic, I put the AS on the main timeline and changed the name of the MC but I dont now how to call the function when I rollover the button…? :puzzled: Teach me please! :trout:

I may be wrong, but i don`t think that is going to work. I think you really need to look at _rotation. Have a look at this and see if it helps.

stringy…u rock! u solve my problem, thanks a lot! and thanks lunatic for helping me too :wink:

:blush: Ack Stringy is right. I forgot the needle has one end that moves and the other end stays stationary. That makes it more difficult. Well, not more difficult but requires more math. :ro:

Sorry I couldn’t help :frowning:

haha, thanks anyways, I always keep track of the people that help me to help them later if I can :wink:

Glad it helped.
Lunatic had already done too many good answers this week anyway.

Yeah, mostly in Random :stuck_out_tongue:

but thanks stringy - you’ve been really on top of stuff recently! Every time I go to try and help someone it seems like I’m 5 minutes behind you! :love: