0

我想在打开和关闭弹出窗口时成为弹出窗口调度事件的父级

[MessageHandler(type="events.MyEvent",selector="newClient",messageProperties="data")]
public function newClientMessageHandler(data:Object):void{

    var parent:Sprite = data.parent; 
    // Component that have to dispatch event

    // Dispatch "open" event
    parent.dispatchEvent(new MyEvent('dialogOpen'));

    var newDialog:ClientsDialog = new ClientsDialog();
    newDialog.addEventListener(CloseEvent.CLOSE, onCloseDialog);
    PopUpManager.addPopUp(newDialog, parent, true);
}

protected function onCloseDialog(event:CloseEvent):void{

    var dialog:UIComponent = event.currentTarget as UIComponent;

    // here i want to "parent" dispatch "close" event something like
    dialog.parent.dispatchEvent(new MyEvent('dialogClose'));

    // but dialog.parent is not the same as "parent" in upper function
    // how do i get that "parent" used in PopUpManager.addPopUp?

    dialog.removeEventListener(CloseEvent.CLOSE, onCloseDialog);    
    PopUpManager.removePopUp(dialog);

}

我如何获得 PopUpManager.addPopUp(newDialog, parent , true);中使用的“父级”?

4

0 回答 0