# Play button backwards

**URL:** <https://forum.kirupa.com/t/play-button-backwards/264821>\
**Category:** Uncategorized\
**Created:** [June 30, 2008, 10:28pm UTC](https://forum.kirupa.com/t/play-button-backwards/264821 "2008-06-30T22:28:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![imBastos](https://avatars.discourse-cdn.com/v4/letter/i/a4c791/32.png) [@imBastos](https://forum.kirupa.com/u/imBastos)\
**Post date:** [June 30, 2008, 10:28pm UTC](https://forum.kirupa.com/t/play-button-backwards/264821/1 "2008-06-30T22:28:10Z")

</div>

hello

im trying to get this button to work, but i can’t seem to get it right. if the user rolls over AND STAYS over the button i want the movie to play all the way through. and if the user rolls over the button and rolls out before the movie hits frame 36 i want the movie to play up to frame 36 and then play backwards. and if the user rolls out after frame 36 i just want it to play backwards. TIA for any help. here’s my code:

stop();

this.onEnterFrame = function(){  
if(rewind == true){ //if rewind switch is set to true play backwards  
prevFrame(); // play backwards  
}  
}

this.onRollOver = function(){  
rewind = false; //set variable that decides wether ot not to play backwards…  
play(); // play this movie clip  
}

this.onRollOut = function(){  
while (this.\_currentframe \< 36){  
this.nextFrame();   
}  
rewind = true;  
}

this.onRelease = function(){  
getURL("##","\_blank");  
}

---

<div class="post-metadata">

**Author:** ![pantas](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@pantas](https://forum.kirupa.com/u/pantas)\
**Post date:** [July 1, 2008, 4:17pm UTC](https://forum.kirupa.com/t/play-button-backwards/264821/2 "2008-07-01T16:17:54Z")

</div>

cut the first onEnterFrame !!

stop();

this.onRollOver = function(){  
delete this.onEnterFrame  
this.play()  
}

this.onRollOut = function(){  
if(this.\_currentFrame \<36){  
this.onEnterFrame = function(){  
this.prevFrame()  
}  
}else{  
this.play()  
if(this.\_currentFrame \>=36){  
this.onEnterFrame = function(){  
this.prevFrame()  
if(this.\_currentFrame == 0){  
delete this.onEnterFrame  
}  
}  
}

this is just a quick writing, hope it helps.  
i didnt test it, but you can see the logic in this code…

cheers
