# Button AS3 Help

**URL:** <https://forum.kirupa.com/t/button-as3-help/286412>\
**Category:** flash\
**Created:** [April 15, 2009, 7:21am UTC](https://forum.kirupa.com/t/button-as3-help/286412 "2009-04-15T07:21:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![broome](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@broome](https://forum.kirupa.com/u/broome)\
**Post date:** [April 15, 2009, 7:21am UTC](https://forum.kirupa.com/t/button-as3-help/286412/1 "2009-04-15T07:21:11Z")

</div>

I have an MC “ **homeBtn** ” that I’m using as an animated button.  
The “ **homeBtn** ” is made of 2 mirroring MC’s named “ **topMC** ” and “ **bottomMC** ” since they mirror and function the same I will be addressing only the “topMC”  
Inside “topMC” is the animation named “ **liquidMC** ”  
These are all MC properties.  
Below is the AS3 Code._Works well but when the mouse scrolls out the animation is stuck ie stops animating and not going back to frame 1, I know there is a code to make it turn off, just haven’t figured it out yet and am looking for help._  
//////////////////////////////////////////////  
import flash.events.MouseEvent;  
stop();

homeBtn.topMC.addEventListener(MouseEvent.MOUSE\_OVER, on\_rollOverH);  
homeBtn.topMC.addEventListener(MouseEvent.MOUSE\_OUT, on\_rollOut);  
homeBtn.topMC.addEventListener(MouseEvent.CLICK, goHome);

function goHome(e:MouseEvent):void {  
gotoAndStop (“home”);  
}

function on\_rollOverH(e:Event):void {  
homeBtn.topMC.liquidMC.play();  
homeBtn.bottomMC.liquidMC.play();  
homeBtn.topMC.play();  
homeBtn.bottomMC.play();  
}  
function on\_rollOut(e:Event):void {  
homeBtn.topMC.liquidMC.stop(); //doesn’t work smoothly  
homeBtn.bottomMC.liquidMC.stop(); //doesn’t work smoothly  
homeBtn.topMC.stop(); //doesn’t work smoothly  
homeBtn.bottomMC.stop(); //doesn’t work smoothly  
}

**Below is the AS2 I am having problems with in coding in AS3**  
///////////////////////////////////////////////

this.topMC.onRollOver = function() {  
buttonOver = true;  
};  
this.topMC.onRollOut = bottomMC.onDragOut = function () {  
buttonOver = false;  
};  
this.onEnterFrame = function() {  
if (buttonOver) {  
this.topMC.liquidMC.play();  
this.bottomMC.liquidMC.play();  
this.topMC.play();  
this.bottomMC.play();  
buttonOver = false;  
}  
};  
stop();  
///////////////////////////////  
ANY help would rock my day :sen:  
Thanks  
Jer
