如何停止在AS3一个影片剪辑内所有子影片剪辑? [英] How to stop all child movieclips inside a movieclip in AS3?
问题描述
我有一个影片剪辑这是在游戏中的角色。这里面的影片剪辑有含四肢有几个动画影片剪辑。所以,做任何人对如何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.
这篇关于如何停止在AS3一个影片剪辑内所有子影片剪辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!