Section 11.0. Introduction


11.0. Introduction

Animation can be defined as any visual change over time. If an image does not change over a period of time, it's impossible to tell whether it is a still image or an animation. There are a variety of properties you can manipulate to produce change, and thus animation. The most obvious is changing an object's position to make it move. You can also change its size, shape, rotation, transparency or color, to name a few. As long as something changes visually, the viewer never sees the animation.

In the earliest versions of Flash, most animation was done by using tweens. An object was placed on a keyframe, another keyframe was made, and the object was changed in some way. Flash filled in the frames in between, hence, the term tween. Using ActionScript, you can create much more dynamic and interactive animation.

As for what you can animate, a movie clip or sprite is usually a good answer. These objects can contain graphics, and they can have methods and properties that allow them to be moved, scaled, rotated, and otherwise transformed any way you see fit. A movie clip would normally be used only in the Flash authoring environment, where additional frames are added, as in a tween.

Finally, you need some way of getting the changes to occur over time. Your best bet is either an enterFrame handler or a timer. ActionScript statements can be used to make changes to the animated object's properties on each frame, or timer cycle, if you're using a timer. Since motion is the most obvious kind of animation, the examples in this chapter start out by moving objects around. As the chapter progresses, you'll see some examples that apply the same techniques to other properties, such as animating the size of an object or its orientation.




ActionScript 3. 0 Cookbook
ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers
ISBN: 0596526954
EAN: 2147483647
Year: 2007
Pages: 351

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