如何使用for循环停止许多MovieClip

时间:2013-11-02 08:29:01

标签: actionscript-3 parent-child movieclip

我使用此代码:

parantClip.childClip1.stop();
parantClip.childClip2.stop();
parantClip.childClip3.stop();
parantClip.childClip4.stop();
parantClip.childClip5.stop();
parantClip.childClip6.stop();
parantClip.childClip7.stop();
parantClip.childClip8.stop();

但我想这样做:

for(var k:int=1; k<9; k++)
    MovieClip(root).parentClip.["childClip"+k].stop();

我该怎么做?

1 个答案:

答案 0 :(得分:0)

试试这个:

(parantClip["childClip" + k] as MovieClip).stop();