Chapter 17. Automated Transitions
So far, you have been creating animations at a low level, where you implement all of the animation code yourself. This certainly yields maximum control over animation and interactivity; however, Flash also gives you a more automated way of animating in the form of the Tween class. This class allows you to create transitions with any movie clip property.
The Tween Class
The Tween class was actually available in Flash MX 2004; however, it was not immediately documented. This is too bad, because it is an immensely useful class. The idea behind this class is that you can take any numeric movie clip property and transition the property values from one number to another number. The general form for the Tween class is as follows:
import mx.transitions.Tween; var myTween:Tween = new Tween(clipHandle:Object, propertyName:String,easingFunction:Function, startValue:Number, stopValue:Number,duration:Number, useSeconds:Boolean);
The first parameter, clipHandle, holds the movie clip being targeted for animation. It can actually hold a handle to any object, such as a component or an instance of a custom class. The second parameter, propertyName, is a string representing which property to change. Some examples are _x, _alpha, and _rotation. The easingFunction parameter ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access