User Guide

1242 TransitionManager class
The usage example uses a dispatcher or listener event model. A TransitionManager instance
(
transitionManagerInstance) dispatches an event (in this case, allTransitionsOutDone)
and the event is handled by a function, also called a handler, on a listener object
(
listenerObject) that you create. You define a method with the same name as the event on
the listener object; the method is called when the event is triggered. When the event is
triggered, it automatically passes an event object (
eventObject) to the listener object
method. Each event object has properties that contain information about the event. In this
case, the
allTransitionsInDone event provides a target property that contains the instance
of TransitionManager that fired the event, so you can use that instance and all its properties
and methods within the code that receives the
allTransitionsInDone event. For more
information, see Chapter 21, “EventDispatcher class,” on page 499.
Example
The following code assigns an object to listen for the allTransitionsOutDone event and
specifies the method to act as the handler for the event. When that method is called to handle
the event, a transition with a direction property of
mx.transitions.Transition.IN has
already completed.
import mx.transitions.*;
import mx.transitions.easing.*;
var myTransitionManager:TransitionManager = new TransitionManager(img1_mc);
myTransitionManager.startTransition({type:Iris, direction:Transition.OUT,
duration:1, easing:None.easeNone,startPoint:5, shape:Iris.CIRCLE});
var myListener:Object = new Object();
myListener.allTransitionsOutDone = function(eventObj:Object) {
trace("allTransitionsOutDone event occurred.");
};
myTransitionManager.addEventListener("allTransitionsOutDone", myListener);
See also
Chapter 21, “EventDispatcher class,” on page 499