# Rollover/Rollout but onclick won't stay :(

**URL:** <https://forum.kirupa.com/t/rollover-rollout-but-onclick-wont-stay/174364>\
**Category:** flash\
**Created:** [January 5, 2006, 1:55am UTC](https://forum.kirupa.com/t/rollover-rollout-but-onclick-wont-stay/174364 "2006-01-05T01:55:08Z")\
**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 5, 2006, 1:55am UTC](https://forum.kirupa.com/t/rollover-rollout-but-onclick-wont-stay/174364/1 "2006-01-05T01:55:08Z")

</div>

Hi!

I’m trying to add a section to my little animated buttons so that when you rollover/rollout it plays the rollover/rollout animation… all is fine in that regard however when i want the buton to go to a certain frame after its clicked and STOP (the buttons are semi transparent and there are lots of them so i want the user to remember which buttons they clicked on). so when i made the if code it just stops the animation on a click but dosent play the rollover/out animation! please help code follows 🙂

ActionScript Code:  
[FONT=Courier New][LEFT]\</p\>  
\<p\>stopCOLOR=#66cc66[/COLOR]; \</p\>  
\<p\>this.[COLOR=#0066cc]onEnterFrame[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#66cc66[/COLOR][COLOR=#66cc66]{[/COLOR] \</p\>  
\<p\>if[COLOR=#66cc66]([/COLOR]rewind == [COLOR=#000000] **true** [/COLOR][COLOR=#66cc66])[/COLOR][COLOR=#66cc66]{[/COLOR] \</p\>  
\<p\>prevFrameCOLOR=#66cc66[/COLOR]; \</p\>  
\<p\>[COLOR=#66cc66]}[/COLOR] \</p\>  
\<p\>[COLOR=#66cc66]}[/COLOR] \</p\>  
\<p\>if [COLOR=#66cc66]([/COLOR][COLOR=#0066cc]this[/COLOR].[COLOR=#0066cc]onPress[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#66cc66[/COLOR][COLOR=#66cc66]{[/COLOR][COLOR=#0066cc]gotoAndPlay[/COLOR] COLOR=#66cc66[/COLOR];[COLOR=#66cc66]}[/COLOR][COLOR=#66cc66])[/COLOR][COLOR=#66cc66]{[/COLOR]\</p\>  
\<p\>[COLOR=#66cc66]}[/COLOR][COLOR=#b1b100]else[/COLOR][COLOR=#66cc66]{[/COLOR]\</p\>  
\<p\>this.[COLOR=#0066cc]onEnterFrame[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#66cc66[/COLOR][COLOR=#66cc66]{[/COLOR] \</p\>  
\<p\>if[COLOR=#66cc66]([/COLOR]rewind == [COLOR=#000000] **true** [/COLOR][COLOR=#66cc66])[/COLOR][COLOR=#66cc66]{[/COLOR] \</p\>  
\<p\>prevFrameCOLOR=#66cc66[/COLOR]; \</p\>  
\<p\>[COLOR=#66cc66]}[/COLOR] \</p\>  
\<p\>[COLOR=#66cc66]}[/COLOR] \</p\>  
\<p\>&nbsp;\</p\>  
\<p\>this.[COLOR=#0066cc]onRollOver[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#66cc66[/COLOR][COLOR=#66cc66]{[/COLOR] \</p\>  
\<p\>rewind = [COLOR=#000000] **false** [/COLOR]; \</p\>  
\<p\>playCOLOR=#66cc66[/COLOR]; \</p\>  
\<p\>[COLOR=#66cc66]}[/COLOR] \</p\>  
\<p\>this.[COLOR=#0066cc]onRollOut[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#66cc66[/COLOR][COLOR=#66cc66]{[/COLOR]\</p\>  
\<p\>rewind = [COLOR=#000000] **true** [/COLOR];\</p\>  
\<p\>[COLOR=#66cc66]}[/COLOR]\</p\>  
\<p\>[COLOR=#66cc66]}[/COLOR]\</p\>  
\<p\>  
[/LEFT]  
[/FONT]
