# Global play and pause button?

**URL:** <https://forum.kirupa.com/t/global-play-and-pause-button/183605>\
**Category:** Uncategorized\
**Created:** [March 28, 2006, 7:24pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605 "2006-03-28T19:24:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [March 28, 2006, 7:24pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/1 "2006-03-28T19:24:49Z")

</div>

:h:

I have 2 buttons (play and pause)…on my main movie.  
I would like for these 2 buttons to play and pause entire movie (different flash movies into 1).

on my play button i have mc = playbutton  
and the as for this is the following:

```auto

on (release) {
 play();
 _root.pause._visible = true;
 _root.playbutton._visible = false;
}

```

on my pause button I have mc = pause  
and the as for this is the following:

```auto

on (release) {
 stop();
 _root.playbutton._visible = true;
 _root.pause._visible = false;
}

```

on my 1st frame of my main movie I have the following as:

```auto

stop();
_root.playbutton._visible = true;
_root.pause._visible = false;

```

my problem is that when I upload this… and test it, its not working. I also tried by removing \_root. to it, but it didn’t work either. I need other .swf’s to pause and play too when its called from the main movie where the buttons are.

anyone please help. :disco:

---

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [March 29, 2006, 3:25pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/2 "2006-03-29T15:25:32Z")

</div>

anyone out there??

I have different .swf and I want to add movie crontrolers (pause, play).

also i have audio on a timeline, (many pieces of audio actually).

so i added the buttons above but i didn’t work.

:red:

---

<div class="post-metadata">

**Author:** ![B\_L\_U\_E](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@B\_L\_U\_E](https://forum.kirupa.com/u/B_L_U_E)\
**Post date:** [March 29, 2006, 5:21pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/3 "2006-03-29T17:21:06Z")

</div>

on those two buttons, stop() and play() are attempting to control the buttons. Try [AS]playbutton.onRelease = function() {  
MovieClipName.play();  
\_root.pause.\_visible = true;  
\_root.playbutton.\_visible = false;  
}  
pause.onRelease = function() {  
MovieClipName.play();  
\_root.pause.\_visible = true;  
\_root.playbutton.\_visible = false;  
}[/AS] where MovieClipName is the on you want to pause and play.

---

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [March 29, 2006, 5:57pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/4 "2006-03-29T17:57:28Z")

</div>

Hello BlueNar… thanks for helping me out!

So I tried your coding on each button and also modified the movie clips to the mc’s I want to control (play and pause). but it gave an error this time.

```auto

**Error** Scene=Scene 1, layer=Layer 23, frame=1:Line 1: Statement must appear within on handler
     playbutton.onRelease = function() {
**Error** Scene=Scene 1, layer=Layer 23, frame=1:Line 1: Statement must appear within on handler
     pause.onRelease = function() {
Total ActionScript Errors: 2 Reported Errors: 2

```

I have the following on play button

```auto

playbutton.onRelease = function() {
 mc1.play();
 _root.pause._visible = true;
 _root.playbutton._visible = false;
}

```

the following on pause button

```auto

pause.onRelease = function() {
 mc1.play();
 _root.pause._visible = true;
 _root.playbutton._visible = false;
}

```

and the following on my first frame (which i didn’t change according to your statement)

```auto

stop();
_root.playbutton._visible = true;
_root.pause._visible = false;

```

did i miss anything there? :nat: (i seriously look like this guy… haha)

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [March 29, 2006, 8:14pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/5 "2006-03-29T20:14:23Z")

</div>

it goes on the frame 😉

---

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [March 29, 2006, 8:18pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/6 "2006-03-29T20:18:54Z")

</div>

> [@nathan99](#):
>
> it goes on the frame 😉

what’s up Nat!.. which frame you are talking about?.. be specific bro! :stare:

---

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [March 29, 2006, 8:22pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/7 "2006-03-29T20:22:45Z")

</div>

You need to put the code on a frame in the timeline that targets those two movieclips. In other words, if the buttons are sitting on the main timeline then put it on the main timeline. If those two buttons are within a movieclip then put it on a frame of the movieclip’s timeline, otherwise you’ll have to change your paths.

:hr:

---

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [March 30, 2006, 9:48pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/8 "2006-03-30T21:48:30Z")

</div>

thanks Lunatic & Nat for your respond.

My buttons are not on the same movie where the mc are. How can I change the root so it would work on the movies that has the mc?

please advice.

Thank you. :whistle:

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [March 31, 2006, 4:45am UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/9 "2006-03-31T04:45:02Z")

</div>

```auto
_root.containerMC.pause.onRelease = function() {//etc....

```

---

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [March 31, 2006, 4:59am UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/10 "2006-03-31T04:59:38Z")

</div>

in other words, \_root is your main timeline. It’s like starting from your C: drive and working inwards through all the folders, though in your case the folders are the movieclips. So start with \_root then target a movieclip that is on the main timeline, then target the movieclip inside that movieclip, like \_root.MC1.MC2 if that makes sense. 🙂 (and I’m speaking in general of how to target things - yours will look different depending on your setup).

---

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [March 31, 2006, 4:15pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/11 "2006-03-31T16:15:25Z")

</div>

hello again, so I tried that but i think my problem is that these buttons are not on the main timeline. neither the mc. I have a separate .swf with buttons for pause and play.

please see my .fla attached.

thanks for helping.

---

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [April 4, 2006, 3:08pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/12 "2006-04-04T15:08:31Z")

</div>

i see what you guys are trying to tell me. but i don’t want to just control some mcs… i want to pause and play the entire flash movie.

how do i go by doing that.

please advice! :hr:

---

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [April 4, 2006, 3:35pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/13 "2006-04-04T15:35:51Z")

</div>

I’m still a bit confused, but I did notice that you have code for a movieclip on your button symbol. When using a button symbol you put the code directly on the button and use

```auto
on(release)

```

When using a movieclip as a button you would put the code on the timeline somewhere, not on the symbol itself and you would address it by instance name such as

```auto
playbutton.onRelease = function()

```

Now, you have the same exact code on both buttons, so I’m not sure what it is you are trying to do - but at least the error messages go away when you change

```auto
playbutton.onRelease = function() {

```

to

```auto
on(release){

```

Hope this makes sense!

---

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [April 4, 2006, 4:01pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/14 "2006-04-04T16:01:09Z")

</div>

well yeah i uploaded the wrong .fla :hair: but yes, i was trying to follow instructions from another helper but i realized that I do not want to play and stop mcs… so i fixed my as. take a look now please.

thanks Lunatic!

---

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [April 4, 2006, 4:27pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/15 "2006-04-04T16:27:37Z")

</div>

okay so, sorry for being confused but what is it you are trying to do with these buttons? What do you mean by “pause the whole movie?” Do you mean you want to stop all sounds, stop the menu from working, etc.? Can you be as specific as possible about what you want the buttons to do? And why? That will help us figure out the right steps.

:hr:

---

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [April 4, 2006, 6:53pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/16 "2006-04-04T18:53:42Z")

</div>

Yes, I would like to use those buttons to pause the entire movie and to play again. the volume icon are working nicely so I don’t have to make modifications to that one. Just the pause/play button. I would like to be able to pause any .swf movies and play back again. Also, this main4.swf is not the main movie… its just another .swf that will be loaded when loading the main movie.

I hope you are following me. All I need is to be able to pause and play my movie.

Thank you Lunatic!!! 🍺

---

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [April 4, 2006, 7:11pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/17 "2006-04-04T19:11:32Z")

</div>

not really sure why you want to pause and play? Can you explain that?

but the only way i can think of is to put all your container clips (i assume you are loading external swfs into container clips) into an array and then apply your stop() and play() actions to the array.

I don’t know but it may be possible to use \_root.stop()? Never tried it though.

---

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [April 4, 2006, 8:15pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/18 "2006-04-04T20:15:25Z")

</div>

> [@lunatic](#):
>
> not really sure why you want to pause and play? Can you explain that?

what I’m trying to have is a button that would allow me to pause my movie.  
another button to allow to play the movie. both buttons I would prefer to be in the same place. just like I had my volume button.

:sigh:

---

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [April 4, 2006, 8:23pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/19 "2006-04-04T20:23:14Z")

</div>

:sigh: well you keep saying “my movie” but you aren’t defining it. You say you have multiple movieclips and multiple external swf files. So you aren’t really clarifying what exactly you want to pause/play. You want to hit the pause button and have the entire fla, all loaded external swfs, all sounds, all button actions, all menu items, etc etc etc stop? And then become active again when you hit play?

Or are you talking about only the currently loaded external swf?

---

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [April 4, 2006, 8:31pm UTC](https://forum.kirupa.com/t/global-play-and-pause-button/183605/20 "2006-04-04T20:31:06Z")

</div>

> [@lunatic](#):
>
> :sigh: well you keep saying “my movie” but you aren’t defining it. You say you have multiple movieclips and multiple external swf files. So you aren’t really clarifying what exactly you want to pause/play. You want to hit the pause button and have the entire fla, all loaded external swfs, all sounds, all button actions, all menu items, etc etc etc stop? And then become active again when you hit play?
> 
> Or are you talking about only the currently loaded external swf?

sorry for the confusion, yes I want to hit the pause button and have the entire .fla, all loaded external swfs, all sounds, all button actions, all menu items, etc etc etc stop, then become active again when I hit play.

:cowbell:

[Next page](https://forum.kirupa.com/t/global-play-and-pause-button/183605.md?page=2)
