Link to home
Start Free TrialLog in
Avatar of prattm
prattm

asked on

How to make a button animation finish animating after mouse leaves

I have a button, and in its over state is a movie clip.  The idea is make the button animate when the mouse hovers over it.  The problem is that it only animates while the mouse is over the button, and stops animating if the user moves the mouse off the button.  Is there anyway to make the animation finish even after the user's mouse is not over the button?  I don't mind if the animation goes continually while the mouse is over the button, I just want it to run to the last frame after the mouse leaves the button (rather than stop right away).  I'm somewhat new to flash mx, so if there is a better way to do what I want, please feel free to suggest it.  Thanks.

Michael
Avatar of OBCT
OBCT

Take the movie clip out of the button and put it on the main scene. Then give that movie clip an instance name like "MC1"
Then add this code on your button.

button1.onRollOver = function () {     //button1 is the instance name of your button
     _root.MC1.gotoAndPlay(2);          //This tells flash to start playing your mc when the mouse is over your button
}

Cheers

-OBCT
Avatar of prattm

ASKER

That seems to work, except the animation is constantly playing when the mouse is not over the button.  Is there a way to only animate it when the button has been hovered over?

Michael
ASKER CERTIFIED SOLUTION
Avatar of OBCT
OBCT

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
prattm,

Please post a comment to let us know how your going and if you need any more help.

Cheers

-OBCT