Major problem - Help - stopping multiple movieclips

Hello Everyone,

I have a problem stopping multiple clips.

I have created a presentation using flash and I have many movie clips which have sub movie clips inside of them.

Ok lets look at one movie clip in detail. Inside one _root movie there are multiple sub movies; each with a different movieclip labels (each movie clip is named with unique labels ie. north, south, east, west, and …).

What I need to do is be able to STOP all these sub movie clips with one stop, and in turn PLAY these same movie clip with a second action.

The only way I know how to stop all these sub movie clips is to target each and every one individually.

This is the code I used on the button to stop:

// _root movie clip label is myHoldermovieclip
// sub clips labeled north, south, east, west
//button is located on _root timeline

on (release);
myHoldermovieclip.north.stop();
myHoldermovieclip.south.stop();
myHoldermovieclip.east.stop();
myHoldermovieclip.weat.stop();

This is the code I used on the button to play:

on (release);
myHoldermovieclip.north.play();
myHoldermovieclip.south.play();
myHoldermovieclip.east.play();
myHoldermovieclip.weat.play();

As you can see this is very lengthy, and I need to repeat this type of action to a multitude of _root movie clips (approx. 50 clips).

Is there any way to code the _root movie clip so that all of its sub movie clip will stop together without targeting each?

Help!!

Thanks :slight_smile:

you could name them sequentialy, mc1, mc2,…, mc2 and use a for loop:


for(i=1;i<=n;i++){
 myHoldermovieclip["clip"+i].stop();
}

or you can put them all in an array, and apply the same logic, or use a for-in loop, like in the fla

Hi nunomira ,

Brilliant idea, the array works great!!

// all I did was substitute my _root movie clip labels into the place of mc in the code below
for (mc in main) {
if (typeof (main[mc]) == “movieclip”) {
main[mc].stop();
}
}

However this has generated two small problems.

First - When I use the array to stop the sub movies the _root movie clip continues to play.
Second - Not all sub movie clips stop. [Not to sure but it could have something to do with the placement of all the sub movie clips. Each sub mc is positioned approx. ten frames apart.]

Any suggestions??

Thanks