Global play and pause button?

: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:


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:


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

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


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:

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:

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.

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.


**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


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

the following on pause button


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)


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

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

it goes on the frame :wink:

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

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:

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:

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

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. :slight_smile: (and I’m speaking in general of how to target things - yours will look different depending on your setup).

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.

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:

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

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

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

playbutton.onRelease = function() {

to

on(release){

Hope this makes sense!

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!

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:

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!!! :beer:

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.

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:

: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: