# Roll out animation code onMousepress STAY help!

**URL:** <https://forum.kirupa.com/t/roll-out-animation-code-onmousepress-stay-help/174340>\
**Category:** Uncategorized\
**Created:** [January 4, 2006, 9:13pm UTC](https://forum.kirupa.com/t/roll-out-animation-code-onmousepress-stay-help/174340 "2006-01-04T21:13:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilostmydream](https://avatars.discourse-cdn.com/v4/letter/i/b487fb/32.png) [@ilostmydream](https://forum.kirupa.com/u/ilostmydream)\
**Post date:** [January 4, 2006, 9:13pm UTC](https://forum.kirupa.com/t/roll-out-animation-code-onmousepress-stay-help/174340/1 "2006-01-04T21:13:06Z")

</div>

hi!

i’ve been trying to code a small variation into the normal roll over roll out animations… i want the animation to stay on the last frame once i click the button. but when i put the code in it dosent even bother playing the rollover/out animations it just goes to the end frame… anyway here is the code so any help would be apreciated!

```auto

stop(); 
this.onEnterFrame = function(){ 
if(rewind == true){ 
prevFrame(); 
} 
} 
if (this.onPress = function(){gotoAndPlay (5);}){
}else{
this.onEnterFrame = function(){ 
if(rewind == true){ 
prevFrame(); 
} 
} 
 
this.onRollOver = function(){ 
rewind = false; 
play(); 
} 
this.onRollOut = function(){
rewind = true;
}
}

```
