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.
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".
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.
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.
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. | ||||


















