September 11th, 2008

Event Fast Forward

In some cases you just want to pass along an Event to it’s parent. Instead of writing a new relay function like..

myEvtDisptchr.addEventListener(Event.TYPE, _onEvent_handler);
function _onEvent_handler($evt:Event):void{
dispatchEvent($evt.clone());
}

..you can just use the inherited function dispatchEvent:

myEvtDisptchr.addEventListener(Event.TYPE, dispatchEvent);

you can also redirect an Event:

myEvtDisptchr.addEventListener(Event.TYPE, myOtherEvtDisptchr.dispatchEvent);

Simple.