我有带有方法的 EventManager 类:
public function addEvent(obj:IEventDispatcher, event:String, listener:Function,
useCapture:Boolean = false, priority:int = 0,
useWeakReference:Boolean = false):void
{
obj.addEventListener(event, listener, useCapture, priority, useWeakReference);
[here event is pushed in my stack]
}
我想做这个:
public class CustomClass extends Sprite
{
public override function addEventListener(type:String, listener:Function,
useCapture:Boolean = false, priority:int = 0,
useWeakReference:Boolean = false):void
{
eventManager.addEvent(this, type, listener, useCapture, priority, useWeakReference);
}
}
但结果调用堆栈是:
customClass.addEventListener ->
eventManager.addEvent ->
customClass.addEventListener ->
eventManager.addEvent ->
customClass.addEventListener ->
...
等等......因为我在 eventManager.addEvent 中调用了 obj.addEventListener
也许你能给我一个解决这个问题的方法吗?