Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Using the Tween and TransitionManager Classes

Using the Tween and TransitionManager Classes

When you install Flash Basic 8 or Flash Professional 8, you also install two powerful classes: the Tween and TransitionManager classes. This section describes how to use these classes with movie clips and Macromedia V2 components (included with Flash MX 2004 and Flash 8) to add animation easily to your SWF files.

If you create a slide presentation or form application with Flash Professional 8 (ActionScript 2.0 only), you can select behaviors that add different kinds of transitions between slides, which is similar to when you create a PowerPoint presentation. You add this functionality into a screen application by using the Tween and TransitionManager classes, which generate ActionScript that animates the screens depending on the behavior you choose.

You can also use the Tween and TransitionManager classes outside of a screen-based document in either Flash Basic 8 or Flash Professional 8. For example, you can use the classes with the component set of version 2 of the Macromedia Component Architecture, or with movie clips. If you want to change the way a ComboBox component animates, you can use the TransitionManager class to add some easing when the menu opens. You can also use the Tween and TransitionManager classes, instead of creating motion tweens on the Timeline or writing custom code, to create your own animated menu system.

Note: The Tween and TransitionManager classes are available only in ActionScript 2.0, but these classes are available in both Flash Basic 8 and Flash Professional 8.

Tween Class

The Tween class enables you to use ActionScript to move, resize, and fade movie clips easily on the Stage by specifying a property of the target movie clip to be tween-animated over a number of frames or seconds. The Tween class also enables you to specify a variety of easing methods. Easing refers to gradual acceleration or deceleration during an animation, which helps your animations appear more realistic. For example, the options on a drop-down list component you create might gradually increase their speed near the beginning of an animation as the options appear, but slow down before the options come to a full stop at the end of the animation as the list is extended. Flash provides many easing methods that contain equations for this acceleration and deceleration, which change the easing animation accordingly.

The Tween class also invokes event handlers so your code may respond when an animation starts, stops, or resumes or increments its tweened property value. For example, you can start a second tweened animation when the first tween invokes its Tween.onMotionStopped event handler, indicating that the first tween has stopped.

TransitionManager Class

The TransitionManager class and the effect-defining transition-based classes enable you to apply impressive transition animation effects quickly to slides and movie clips.

As its name implies, the TransitionManager class manages transitions by implementing animation events. It enables you to apply one of 10 animation effects to movie clips. The transition effects are defined in a set of transition classes that all extend the base class mx.transitions.Transition.