Recipe 4.12. Creating Nested Animations


Problem

You want to create an animation within an animation, such as the wheels on a car or a bird flying.

Solution

Store the child animation in a movie clip, and place an instance of that movie clip in the timeline of the parent animation.

Discussion

Certain types of animation are possible only by nesting animations within one another. For example, consider the case of a bird flying across the stage. The bird is flapping its wings, and at the same time it is moving from one side of the stage to the other. In order to achieve the correct effect, it's necessary to animate the wings flapping within a movie clip, and then you can tween an instance of that movie clip across the stage.

Flash enables nested animations with movie clip symbols. Movie clip symbols' timelines play independently of the main timeline, and you can nest practically any number of movie clips inside of each other.

To create a nested animation, follow these steps:

  1. Create a new movie clip symbol by choosing Insert New Symbol or by converting existing artwork to a symbol (Insert Convert to Symbol). In the Create New Symbol or Convert to Symbol dialog box, name the movie clip and set its behavior to Movie Clip.

  2. Return to the main timeline. If you started by creating a new symbol rather than converting existing artwork to a symbol, drag an instance of the new symbol to the stage. Otherwise, you ought to already have an instance of the symbol on the stage.

  3. Animate the symbol instance.

One aspect of working with nested animations that can be challenging is that nested animations are not previewed in the authoring environment. When you export or test the movie, the nested animation will play. However, in the authoring environment you'll only see the first frame of the nested animation. If you want to quickly preview the nested animation within the context of the parent timeline, assuming the parent timeline has enough frames, you can temporarily change the behavior of the symbol to Graphic from the Instance behavior menu in the Property inspector. Make sure to change the behavior back to Movie Clip before exporting the movie.

See Also

Recipe 4.7




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net