# Rewind Button AS3

**URL:** https://forum.kirupa.com/t/rewind-button-as3/243989
**Category:** flash
**Created:** [November 13, 2007, 11:37am UTC](https://forum.kirupa.com/t/rewind-button-as3/243989 "2007-11-13T11:37:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Rundevo](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@Rundevo](https://forum.kirupa.com/u/Rundevo)
#### Post date: [November 13, 2007, 11:37am UTC](https://forum.kirupa.com/t/rewind-button-as3/243989/1 "2007-11-13T11:37:32Z")

</div>

Hi all

First off, I´m fairly new to Actionscript, but I understand the basics.

What I´m trying to do is to create buttons that acts like the buttons on [http://www.newstoday.com/](http://www.newstoday.com/)

However, they are activated from an external swf, but I would like to have them static on my timeline.

The code I have so far is something in the ways like this.

stop();

hitArea.buttonMode = true;

var hrewind:Boolean = false;  
hitArea.addEventListener(Event.ENTER\_FRAME, rewindButton);  
hitArea.addEventListener(MouseEvent.MOUSE\_OVER, playButton);  
hitArea.addEventListener(MouseEvent.MOUSE\_OUT, startRewind);

function rewindButton(event:Event){  
if(hrewind) prevFrame();  
}  
function playButton(event:MouseEvent){  
hrewind = false;  
gotoAndPlay(“overMenu”)  
}  
function startRewind(event:MouseEvent){  
hrewind = true;  
}

It works out okay, but when I add another button using the same script it rewinds all the way do the starting frame, resulting in making the first button rewind itself after the second button, as it rewinds back in the timeline.

Can someone help me get around this problem, or point me in the correct way if I have written something wrong in the code or misunderstood the whole concept of rewinding buttons.

Thanks in advance.
