Best way to pause multiple movie clips

Okay, I have a pause button with a stop action on it. I just recently found out how to target movie clips in order to pause them as well, but I am wondering the best way to assign the action pause all movie clips used in the scene at once.
Do I have to list each one seperately or can I target them all in the same action?

Example:
<hr>
on (release) {
_root.movieclip#1name.stop ();
}
on (release) {
_root.movieclip#2name.stop ();
}
<hr>
OR can I do it like this
<hr>
on (release) {
_root.movieclip#1name,movieclip#2name,movieclip#3name.stop ();
}
<hr>

Thanks for any help
:nerd:

put an and instead of the comas and make sure to put a space on both sides of it…like on(release) {
+root.movieclip1.stop() and movieclip2.stop();
}
it SHOULD work

you could use a for in loop. :wink:

on (release) {
for (var clips in _root) {
_root[clips].stop();
}
}

Okay thanx guys-
My email wasn’t saying I had any replies so I went ahead and just tried it without checking here first. I ended up doing them
all seperately like my first example.

I have to do it in several places though, so I will probably try the example you gave, crazygamer.

Kax, I don’t really understand the for in loop thing…are you saying that I could just use this one piece of code and it would
take care of stopping all the clips without naming them all?

:q:

yep… i just found out this for and while stuff and its really neat… with the for… in statment it will contol all the movie clips in the place you have defined as in… and that all… so its really good… anyway there was a flash beginer trying to sound like an expert… did it work?? doubt it… =p anyway… maybe kax can explain it better…

jillymo i just notice i put a plus in the code…WHOOPS…don’t add that…that’s just a type!

thank aussie I am an AS beginner too, so I pretty much got what you were saying. Except for this part:
<hr>
you have defined as in
<hr>
what do you mean when you say you have to define them as in?

opps other way round should be “in the place you have deffined in as” which mean that… if u take an example of the code


for(clips in _root){
     _root.[clips].stop()
}

if you look the script you see that the “in” is set as the _root which is the main timeline so at the moment the script will seach the maintime line for any movie clips regardless of their names. Then when it has done that the script then regonises them by calling them clips and then tells clips to stop… so what you rename clips to makes no difference as long as its the same in the for statment and infront of the stop() and the only inportant thing is where u have to tell the script to search for movie clips.

Well i read that all out of the flash mx bible for the first time only ½hr ago… so it might not make much sense… so… anyway… hope i helped…

Originally posted by jillymo
are you saying that I could just use this one piece of code and it would take care of stopping all the clips without naming them all?

yup… that’s what i said. :wink:

http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary275.html

or yeah u could read the explaination on the macromedia site which is defiantly better than mine… anyway… i tried atleast… lol…

//Scotty//

that’s what matters aussie, you tried. :wink:
and it wasn’t bad at all. =)

yeah… thanks… can just ask you one question and then i will leave this thread alone…

How long have you been using flash kax?? too get this good??

Anyway… glad i helped… even if it was a little bit…

//Scotty//

see my profile. i’ve been using flash since the day i registered here. :slight_smile:

=)
Thanks again guys…I get it!! :love:
Aussie I think you did a great job explaining.

Thanks… glad we could help… and kax youve been using flash for a shorter time than me… your pretty good… anyway… i guess i should get back to increasing my flash skills… so… zya people…

//Scotty//

you’re welcome, jillymo. =)

and thanks, aussie. but there’s a lot of things still to learn. :wink:

Hey Crazygamer this DOES work :bounce:
Thank you!

<hr>
put an and instead of the comas and make sure to put a space on both sides of it…like on(release) {
+root.movieclip1.stop() and movieclip2.stop();
}
it SHOULD work
<hr>

without the (oops) plus sign of course :wink: