我在 Robotlegs 中创建了一个调解器,它的相关视图将调度两种不同类型的事件。当中介捕获事件时,它只会简单地分派事件。我遇到的问题是第一个事件被完美地重新调度,但第二个事件没有被调度。
但是,如果我手动为第二个事件分配不同的处理程序,则该事件会被正确捕获。
下面是相关代码:
public class MyMediator extends Mediator
{
[Inject]
public var view:MyView;
public override function onRegister():void
{
super.onRegister();
addViewListener( SomeEventTypeA.COOL_EVENT, dispatch, SomeEventTypeA ); // This event is dispatched correctly
addViewListener( SomeEventTypeB.STUCK, dispatch, SomeEventTypeB ); // This one is not correctly dispatched
//A twist, if I uncomment the following code, the event is captured by its handler
//addViewListener( SomeEventTypeB.STUCK, view_stuck, SomeEventTypeB );
}
private function view_stuck( event:SomeEventTypeB ):void
{
//ah ha, this is called correctly if the above relevant line is uncommented
}
}