# Very basic pause/play buttons

**URL:** <https://forum.kirupa.com/t/very-basic-pause-play-buttons/264767>\
**Category:** flash\
**Created:** [June 30, 2008, 11:27am UTC](https://forum.kirupa.com/t/very-basic-pause-play-buttons/264767 "2008-06-30T11:27:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![karatekitties](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@karatekitties](https://forum.kirupa.com/u/karatekitties)\
**Post date:** [June 30, 2008, 11:27am UTC](https://forum.kirupa.com/t/very-basic-pause-play-buttons/264767/1 "2008-06-30T11:27:16Z")

</div>

Hi all,  
i’m trying to add a pause and play button onto my timeline animation, so that when i hit pause/play, all animation will pause/play at the same time:

so i use:

\*\* on (press) {  
play();  
}\*\*

and  
\*\*  
on (press) {  
stop();  
}\*\*

on each button respectively.

it works fine until i realised that i have several movie clips within this main timeline, and the above command doesn’t stop those movie clip animations as well.

what additional line of code should i put in?

basically the main timeline is where my animation is, with a few movie clips on various spots.

your help is much appreciated! 😃

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 30, 2008, 11:44am UTC](https://forum.kirupa.com/t/very-basic-pause-play-buttons/264767/2 "2008-06-30T11:44:41Z")

</div>

you have to specify the MC and tell it stop… strange thing computers, they only do what they are told… most of the time

click the MC and call it something in properties

\_root.helloMC.stop()

…

ps timeline effects and AS aren’t a healthy mix

---

<div class="post-metadata">

**Author:** ![karatekitties](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@karatekitties](https://forum.kirupa.com/u/karatekitties)\
**Post date:** [June 30, 2008, 5:16pm UTC](https://forum.kirupa.com/t/very-basic-pause-play-buttons/264767/3 "2008-06-30T17:16:11Z")

</div>

[quote=randomagain;2351279]you have to specify the MC and tell it stop… strange thing computers, they only do what they are told… most of the time

click the MC and call it something in properties

\_root.helloMC.stop()

…

ps timeline effects and AS aren’t a healthy mix[/quote]

hi it works great, thanks!!

btw, is there a way to toggle the play/pause button, so that there’s only ONE btn (play/pause) at anytime on the screen?

---

<div class="post-metadata">

**Author:** ![glosrfc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/glosrfc/32/8334_2.png) [@glosrfc](https://forum.kirupa.com/u/glosrfc)\
**Post date:** [June 30, 2008, 11:47pm UTC](https://forum.kirupa.com/t/very-basic-pause-play-buttons/264767/4 "2008-06-30T23:47:35Z")

</div>

```auto
on (press) {
 toggled = !toggled;
 if (toggled) {
  stop();
 } else {
  play();
 }
}

```

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [July 1, 2008, 12:36am UTC](https://forum.kirupa.com/t/very-basic-pause-play-buttons/264767/5 "2008-07-01T00:36:46Z")

</div>

(toggled = !toggled) ? stop() : play();

one-liner :party:
