Flash CS3 Documentation |
|||
| Learning ActionScript 2.0 in Adobe Flash > Animation, Filters, and Drawings > About the Tween and TransitionManager classes > Adding tweens and transitions to a file in Flash | |||
|
NOTE |
|
This section describes adding tweens and transitions to a Flash slide presentation to demonstrate what they look like for Flash users. However, you can add transitions and tweens to your Flash applications if you use code. The following sections include examples that show you how. |
The Tween and TransitionManager classes are designed to let you use simple ActionScript to add animations to parts of your SWF file. The Flash authoring environment contains behaviors that let you use these prebuilt classes for transitions in a screen-based application. To create a slide presentation or form application, you can select behaviors that add different kinds of transitions between slides.
Before you start to use these transitions with movie clips in Flash, you should see what they do when you use a screen-based application.
This adds about 15 lines of ActionScript directly onto the slide. The following snippet shows the relevant transition code:
mx.transitions.TransitionManager.start(eventObj.target, {type:mx.transitions.Zoom, direction:0, duration:1, easing:mx.transitions.easing.Bounce.easeOut, param1:empty, param2:empty});
This code calls the TransitionManager class and then applies the Zoom transition with the specified mx.transitions.easing.Bounce.easeOut easing method. In this case, the transition applies to the selected slide. To apply this effect to a movie clip, you can modify the ActionScript to use in your Flash animations. Modifying the code to work with a movie clip symbol is easy: change the first parameter from eventObj.target to the desired movie clip's instance name.
Flash comes with ten transitions, which you can customize by using the easing methods and several optional parameters. Remember, easing refers to gradual acceleration or deceleration during an animation, which helps your animations appear more realistic. For example, a ball might gradually increase its speed near the beginning of an animation, but slow down before it arrives at a full stop at the end of the animation. There are many equations for this acceleration and deceleration, which change the easing animation accordingly.
The following table describes the transitions included in Flash.
|
Transition |
Description |
|---|---|
|
Iris |
Reveals the screen or movie clip by using an animated mask of a shape that zooms in. |
|
Wipe |
Reveals the screen or movie clip by using an animated mask of a shape that moves horizontally. |
|
Pixel Dissolve |
Masks the screen or movie clip by using disappearing or appearing rectangles. |
|
Blinds |
Reveals the next screen or movie clip by using disappearing or appearing rectangles. |
|
Fade |
Fades the screen or movie clip in or out. |
|
Fly |
Slides in the screen or movie clip from a particular direction. |
|
Zoom |
Zooms the screen or movie clip in or out. |
|
Squeeze |
Scales the current screen or movie clip horizontally or vertically. |
|
Rotate |
Rotates the current screen or movie clip. |
|
Photo |
Has the screen or movie clip appear like a photographic flash. |
Each transition has slightly different customizations that you can apply to the animation. The Transitions dialog box lets you preview a sample animation before you apply the effect to the slide or form.
|
TIP |
|
To preview how each transition works with the different methods in the easing classes, you can double-click Transition.swf in boot drive\Program Files\Adobe\Adobe Flash CS3\language\First Run\Behaviors\ folder or Macintosh HD:Applications:Adobe Flash CS3:First Run:Behaviors: to open the SWF file in the stand-alone player. |
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00000961.html