var mainmc:MovieClip;
var mc1:MovieClip;
var mc2:MovieClip;
var mc3:MovieClip;
var lastmc:MovieClip;
mainmc.addChild(mc1);
mainmc.addChild(mc2);
mainmc.addChild(mc3);
mc1.addChild(lastmc);
mc2.addChild(lastmc);
mc3.addChild(lastmc);
for(var i=1; i<4; i++){
mainmc.?????.lastmc.visible=false;
}
我需要在问题上写下什么?
答案 0 :(得分:0)
无。您不能同时向多个父母添加相同的MovieClip lastmc
。从您的代码中,lastmc
将只在mc3
如果您想迭代mainmc
的孩子:
var i: uint, len: uint = mainmc.numChildren, movie:MovieClip;
for(i; i < len; ++i){
movie = mainmc.getChildAt(i) as MovieClip;
if(movie != null && movie.numChildren > 0){
movie.getChildAt(0).visible = false;
}
}