我想發送一個事件2次:Multiple dispatchHandler Actionscript 3
我有一個MainClass,一個SecondClass和一個ThirdClass。
在ThirdClass中,有一個clickEvent。我把它分派給二等:
this.addEventListener(MouseEvent.CLICK, clickHandler);
public static const CLICKED_HANDLER:String = "clickedHandler";
public function clickHandler(e:MouseEvent):void {
dispatchEvent(new Event(CLICKED_HANDLER));
}
我抓住,並把它在二等:
object.addEventListener(ThirdClass.CLICKED_Handler, clickedEventListener);
public static const CLICKED_HANDLER:String = "clickedHandler";
public function clickedEventListener(e:Event):void {
dispatchEvent(new Event(CLICKED_HANDLER));
}
這我趕在MainClass:
object.addEventListener(SecondClass.CLICKED_HANDLER, clickedEventListener);
public function clickedEventListener(e:Event):void {
trace("click");
}
但它不會工作......我做錯了什麼? 我怎樣才能獲得有關被點擊的ThirdClass對象的信息? (Normaly 1個dispatchEvent,它與:
var thirdClassObject:ThirdClass = e.currentTarget as ThirdClass;
在clickHandler方法
,但如何與2個dispatchEvents做到這一點?)
所以我想在我的MainClass知道哪個三級欄目,目的是點擊。
非常感謝!