Internet Explorer 6 is not supported.
Upgrade to view this site.

TransitionManager Events

Posted on January 26, 2009 at 3:07 pm

I recently used the TransitionManager class to get some ready-made animation in a project I am working on. The problem was I needed to know when the tween ended so I could dispatch an event to tell my application to allow user interfacing again. I checked the Adobe API on TransitionManager and there were no events to respond to be found there. Not even a useful inherited event. So I decided to poke around in the class file itself just to see what was going on in there. In case you don’t know, never edit these classes. They are essentially part of the Flash application. If you need extra functions it’s always better to make a subclass extending the class and write your own methods and properties. That what OOP is all about.

There are 2 events that can be responded to in their without editing the code to do so. The two strings that you can add a listener for are these.

1
2
const ALL_TRANSITIONS_IN_DONE:String = "allTransitionsInDone";
const ALL_TRANSITIONS_OUT_DONE:String = "allTransitionsOutDone";

Of course, these events don’t carry any TransitionManager specific properties, it just dispatches the generic Event telling the application that it happened. I don’t know why this wasn’t included in the API, as it is something that is useful for this the implementation of this class. Maybe I’ll get around to writing a TransitionManagerEvent class one day. Until then, this works.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import fl.transitions.*;
import fl.transitions.easing.*;
 
const ALL_TRANSITIONS_IN_DONE:String = "allTransitionsInDone";
const ALL_TRANSITIONS_OUT_DONE:String = "allTransitionsOutDone";
 
var currentSlide:Slide = new Slide();
addChild(currentSlide);
 
var tm:TransitionManager = new TransitionManager(currentSlide);
tm.startTransition({type:Blinds, direction:Transition.OUT, duration:2, easing:None.easeNone, numStrips:10, dimension:0});
tm.addEventListener(ALL_TRANSITIONS_OUT_DONE, outTransitionsDone);
 
function outTransitionsDone(event:Event):void
{
	trace("done");
}

You can get the FLA example file here.

Leave a Comment

*Required fields. Email will not be published.