I'm confused about开发者_运维技巧 changing an instance's animation. I'm working on a really simple game to learn AS3 and I've got the controls down, but don't know how to change the animation of the player instance. I have movieclips for different animations, which I assume I should, but don't know how to switch the instance's appearance between them. Thanks for any help.
One common way to switch between different animations is to place all of the animation MovieClips inside another MovieClip, with each animation being on its own keyframe. You can give these frames labels corresponding to the animation, e.g. idle, walk, shoot, die. This MovieClip will be your player clip, and you can switch between animations with this code inside the player:
gotoAndStop("idle");
This will jump to the appropriate frame. Even though the outer MovieClip is stopped on the idle frame, the inner animation MovieClip will play normally.
精彩评论