# Play/Pause Rollover Button

**URL:** https://forum.kirupa.com/t/play-pause-rollover-button/118184
**Category:** Uncategorized
**Created:** [August 3, 2004, 1:47pm UTC](https://forum.kirupa.com/t/play-pause-rollover-button/118184 "2004-08-03T13:47:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![heatherA143](https://avatars.discourse-cdn.com/v4/letter/h/a9a28c/32.png) [@heatherA143](https://forum.kirupa.com/u/heatherA143)
#### Post date: [August 3, 2004, 1:47pm UTC](https://forum.kirupa.com/t/play-pause-rollover-button/118184/1 "2004-08-03T13:47:09Z")

</div>

I’m looking to create a button that when clicked will pause the flash movie and when clicked again will continue playing. If possible, I would also like to be able to swap the images when clicked. So, for example, when the movie is playing there would be a button that says “pause”. When the button is clicked, the movie would pause and the button would switch to one that says “resume play”. Then when that button is clicked, the movie would play and the button would switch back to “pause”.

Is there any way to do this? I’ve done it a lot in Director, but can’t seem to get it to work in Flash. Please help!!!

---

<div class="post-metadata">

### Author: ![bobdoe](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bobdoe](https://forum.kirupa.com/u/bobdoe)
#### Post date: [August 3, 2004, 2:08pm UTC](https://forum.kirupa.com/t/play-pause-rollover-button/118184/2 "2004-08-03T14:08:49Z")

</div>

Search is a powerful tool. This simple code might just do it:  
on(release){  
\_root.my\_mc.stop();  
}

---

<div class="post-metadata">

### Author: ![Lomadrian](https://avatars.discourse-cdn.com/v4/letter/l/9de0a6/32.png) [@Lomadrian](https://forum.kirupa.com/u/Lomadrian)
#### Post date: [August 3, 2004, 2:20pm UTC](https://forum.kirupa.com/t/play-pause-rollover-button/118184/3 "2004-08-03T14:20:48Z")

</div>

OK, here’s the best way to do this:

Make two different buttons: a pause button and a play button. Then make a new MovieClip. Put two keyframes at the beginning of that clip, and put this code in each one:

```auto
stop();

```

Put your pause button in the first frame. Click on it, and put in this code:

```auto
on (release) {
   _parent.stop();
   gotoAndStop(2);
}

```

Put your play button in the second frame. Click on it, and put in this code:

```auto
on (release) {
   _parent.play();
   gotoAndStop(1);
}

```

That’s it. So how does this work? First, when you click on the pause button, it makes the MovieClip above it stop playing, and then it tells this MovieClip to go to frame 2, which has the play button in it. When you click on that, it tells the \_parent MovieClip to start playing again, and sends this MovieClip back to frame 1, which has the pause button.

Hope this helps.
