Alright, so I guess my understanding of custom events isn’t that great. For discussion sake, let’s say I have three classes: base, object, custom eventdispatcher. The objects is an animation that uses the Tweener class. Once the animation is complete, it dispatches a custom event, “ANIM_DONE.” Now, my understanding of events is that it should “bubble up” until reaches it’s listener, which I have setup in the base class. But I am getting nothing, which tells me it not making its way up to the base class. Here’s the code:
Base
package{
import flash.events.*;
import flash.display.*;
import Animation;
public class Base extends MovieClip{
public function Base(){
var anim:Animation = new Animation();
var customEvent:CustomEvent = new CustomEvent();
customEvent.addEventListener(customEvent.ANIM_DONE, nextAnimation);
}
public function nextStep(e:Event){
trace("nextStep")
}
}
}
Object
package{
import flash.events.*;
import flash.display.*;
public class Animation extends MovieClip{
var ce:CustomEvent = new CustomEvent();
public function Animation(){
Tweener.addTween(logo, {alpha:1, time:.5, delay:5.7, transition:"easeInQuart", onComplete:ce.animFinished});
}
}
}
CustomEvent
package{
import flash.events.*;
public class CustomEvent extends EventDispatcher{
public static const ANIM_DONE:String = "animDone";
public function animFinished():void{
trace("animFinished");
dispatchEvent(new Event(CustomEvent.ANIM_DONE));
}
}
}
What am I missing? Thanks in advance.