g
Printer Friendly Version

editor  
BellaOnline's Flash and Animation Editor
 

Flash CS3 TransitionManager.start() Method

Now that we have examined the various transitions in the fl.transitions package for FlashR CS3, it's time to take a look at the code that runs these effects. The most common way to run these effects is with the TransitionManager.start() method which creates a TransitionManager instance, applies the transition effect to the object of your choice and starts the transition. This method has several parameters which you can set to control the effect. Here is the basic code.

import fl.transitions.*;
import fl.transitions.easing.*;

// apply transition
TransitionManager.start(name_of_object, {type:name_of_effect, direction:Transition.IN, duration:5, easing:None.easeNone});

As you can see, the code begins with TransitionManager.start(). Inside the parentheses are the parameters. The first parameter is the content parameter which tells Flash the name of the object that you wish to apply the effect to. Let's use the same photo that I used when I made the examples. We will set the content parameter to "photo_mc". But, first we need to import the photo and convert it to a movie clip, which we will call "photo". Then, we will give the movie clip the instance name of "photo_mc".

TransitionManager.start(photo_mc, {type:name_of_effect, direction:Transition.IN, duration:5, easing:None.easeNone});

After the comma, we have more parameters between curly brackets but still within the parentheses. These parameters are called transParams parameters and are used for any of the transition effects. They are the type, direction, duration and easing parameters. You will set the type parameter to the name of the transition effect class you wish to use. Let's set this to the Fade transition and set the rest of the parameters to the following, which will set the direction inward, the duration to 5 seconds and no easing.

type Fade
direction Transition.IN
duration 5
easing None.easeNone

The code for the Fade transition will look like this.

TransitionManager.start(photo_mc, {type:Fade, direction:Transition.IN, duration:5, easing:None.easeNone});

Other transitions that can use this same code are the Photo and Zoom effects. You only need to change the content parameter to the effect you wish to use.

TransitionManager.start(photo_mc, {type:Photo, direction:Transition.IN, duration:5, easing:None.easeNone});

TransitionManager.start(photo_mc, {type:Zoom, direction:Transition.IN, duration:5, easing:None.easeNone});

The rest of the transitions take a little more coding with the addition of the transition effect class parameters. We will discuss these in the next lesson.

Join us in the Flash forum.




Flash and Animation Site @ BellaOnline
View This Article in Regular Layout

Content copyright © 2013 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.



| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2013 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor