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 *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>