如何停止在AS3一个影片剪辑内所有子影片剪辑?影片剪辑

由网友(我們都太年輕)分享简介:我有一个影片剪辑这是在游戏中的角色。这里面的影片剪辑有含四肢有几个动画影片剪辑。所以,做任何人对如何gotoAndStop建议(1);在所有的字符内,无需手动调用每一个肢体对象的影片剪辑?I have a movieclip which is a character in a game. Inside this mo...

我有一个影片剪辑这是在游戏中的角色。这里面的影片剪辑有含四肢有几个动画影片剪辑。所以,做任何人对如何gotoAndStop建议(1);在所有的字符内,无需手动调用每一个肢体对象的影片剪辑?

I have a movieclip which is a character in a game. Inside this movieclips there are several movieclips containing limbs that has an animation. So do anyone have a suggestion on how to gotoAndStop(1); on all the movieclips that are inside the character without having to call on every limb object manually?

字符影片剪辑总共包含20影片剪辑的4帧,所以我只是想阻止所有的影片剪辑的性格里面。

The character movieclip contains a total of 20 movieclips on 4 frames, so I just want to stop all of the movieclips inside the character.

推荐答案

如果我理解正确的话(即:停在另一个影片剪辑的所有影片剪辑),这应该工作:

If i understand you correctly (ie: stop all movieclips within another movieclip), this should work:

function stopAllClips(mc:MovieClip):void
{
    var n:int = mc.numChildren;
    for (var i:int=0;i<n;i++)
    {
        var clip:MoviceClip = mc.getChildAt(i) as MovieClip;
        if (clip)
            clip.gotoAndStop(1);
    }
}

只是把它像这样:

Just call it like so:

stopAllClips(yourMovieClip);

在哪里yourMovieClip是字符。

Where yourMovieClip is the character.

阅读全文

相关推荐

最新文章