# Giving a button a mouse out animation

**URL:** <https://forum.kirupa.com/t/giving-a-button-a-mouse-out-animation/98440>\
**Category:** Uncategorized\
**Created:** [January 7, 2004, 6:29am UTC](https://forum.kirupa.com/t/giving-a-button-a-mouse-out-animation/98440 "2004-01-07T06:29:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ham](https://avatars.discourse-cdn.com/v4/letter/h/ecb155/32.png) [@ham](https://forum.kirupa.com/u/ham)\
**Post date:** [January 7, 2004, 6:29am UTC](https://forum.kirupa.com/t/giving-a-button-a-mouse-out-animation/98440/1 "2004-01-07T06:29:21Z")

</div>

Alright, so I have an idea for a good roll over, but when the user rolls out, I dont want it to go to square one, but rather do an animation that takes it back, making it fluid.

Any help? =)

---

<div class="post-metadata">

**Author:** ![kfur](https://avatars.discourse-cdn.com/v4/letter/k/59ef9b/32.png) [@kfur](https://forum.kirupa.com/u/kfur)\
**Post date:** [August 2, 2004, 8:42am UTC](https://forum.kirupa.com/t/giving-a-button-a-mouse-out-animation/98440/2 "2004-08-02T08:42:34Z")

</div>

Check it dude,  
1.Make an actions layer inside your button movieClip.  
2.In the actionscript inspector for that first frame type stop();  
3.Animate your rollover on your timeline inside the button MC.  
4.ON THE MAIN TIMELINE put another actions layer in this one put the script:  
your MC.onRollOut = function() {  
if (this.enabled) {  
this.onEnterFrame = function() {  
this.prevFrame();  
};  
}  
};  
your MC.onRollOver = function() {  
if (this.enabled) {  
this.onEnterFrame = function() {  
this.nextFrame();  
};  
}  
};

I put your MC where you should put the instance name of your button.  
This will play your movie forward onRollOver then backwards onRollOut.  
Pretty sick huh?

I left the enabled disabled part for you to figure out. It’s easy, just remember to run a resetButtons after onRelease or they will stick.  
kfur
