ActionScript 3.0: Events for Static Classes

Normally, a static class in ActionScript 3.0 can’t dispatch events, since you can’t inherit from EventDispatcher or implement IEventDispatcher if the functions are a static.
However, with ActionScript 3.0, you can create an EventDispatcher object to do the dispatching for you!

package {
import flash.events.EventDispatcher;
public class StaticEventDispatcher {
public static var eventEngine:EventDispatcher;
public static function initialize():void
{
eventEngine = new EventDispatcher();
}
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *