摘自:http://www.darronschall.com/weblog/archives/000100.cfm
1。Using a static initializer in the class
private static var EventDispatcher_mixin =
EventDispatcher.initialize(MyClass.prototype);
2。Using the constructor to initialize the instance as an event source:
EventDispatcher.initialize(this);
3。Using composition:
private var eventSrc:Object
EventDispatcher.initialize(eventSrc);
public function registerView(view) {
eventSrc.addEventListener("change", view);
}
public function removeView(view) {
eventSrc.removeEventListener("change", view);
}
private function doSomething() {
var eventObj:Object = new Object();
eventObj.target=this;
eventObj.type = "change";
eventSrc.dispatchEvent(eventObj);
}