0
votes

I think I have a very simple question because I can't find anybody who asked it before me. So I have mc1 and mc2. I want to do something like this:

(mc1,mc2).stop();

instead of:

mc1.stop();
mc2.stop();

What is the correct form to do this??

another example how my code looks like now:

function playReverse(e:Event):void {
    if (mc1.currentFrame == 1) {
        stopPlayReverse();
    } else {
        mc1.prevFrame();
    }
    if (mc2.currentFrame == 1) {
        stopPlayReverse();
    } else {
        mc2.prevFrame();
    }
}
1

1 Answers

2
votes

The following should get you started:

var mcs:Array = [mc1, mc2, mc3, mc4];
for ( var i:int = 0, l:int = mcs.length; i < l; i++ ) {
    var mc:Movieclip = mcs[i] as MovieClip;
    if ( i == 0 ) mc.play(); // or watever condition you need to check...
    else mc.stop();
}

or you may also use for each:

for each ( var mc:MovieClip in mcs ) 
  mc.stop();