package{
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;
public class ASEventDispatcher extends EventDispatcher{
private var events:Array
public function ASEventDispatcher(target:IEventDispatcher=null){
super(target);
events=[];
}
override public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void{
events.push({type:type,fun:listener})
super.addEventListener(type, listener, useCapture, priority, useWeakReference);
}
override public function removeEventListener (type:String, listener:Function, useCapture:Boolean = false):void{
super. removeEventListener(type,listener, useCapture);
for(var i:int=0;i< ;i++){
if( events[i].type==type && events[i].fun==listenner){
events.splice(i,1)
}
}
}
public function dispose():void{
var ev:Object;
while(events.length){
ev=events.pop();
super.removeEventListener(ev.type,ev.fun);
}
}
}
}