as3如何播放多个movieclip

时间:2013-11-06 14:33:52

标签: arrays actionscript-3 movieclip

数组中有3个movieclip。怎么玩所有movieclip

var mc1:MovieClip;
var mc2:MovieClip;
var mc3:MovieClip;
var mcArray:Array=["mc1","mc2","mc3"];

mcArray.gotoAndStop(2);// ????????????

1 个答案:

答案 0 :(得分:1)

/*
var mc1:MovieClip;
var mc2:MovieClip;
var mc3:MovieClip;
*/

// Assuming MovieClips are on stage with the correct instance names 
// and are accessible from the frame this code is on.
var mcArray:Array=[mc1, mc2, mc3];

for (var i:int = 0; i < mcArray.length; i ++) {
    mcArray[i].gotoAndStop(2);
}