我有一个带有动画片段和形状的MC。有没有办法循环每个孩子,但仅限于MovieClips?由于形状原因,我一直得到一个空对象。
for (var i:int = 0; i < this.numChildren; i++) {
var obj:MovieClip = getChildAt(i) as MovieClip;
}
在这里,我认为“正如MovieClip”只会追踪MovieClip ......
答案 0 :(得分:2)
for (var i:int = 0; i < this.numChildren; i++) {
if( getChildAt(i) is MovieClip ){
var obj:MovieClip = getChildAt(i) as MovieClip;
...
}
}