我正在尝试将an inline Callout添加到我的联网flex移动应用程序中,该应用程序会询问用户 - 如果她确定,她想要离开聊天室。
但是我得到编译器错误 - 因为下面的(非静态)函数fetch(MyEvent.LEAVE)
属于父视图。
是否仍有办法调用它(可能通过outerDocument
,parent
,owner
或类似的smth。?
<fx:Declarations>
<fx:Component className="ConfirmLeave">
<s:Callout
horizontalPosition="middle"
verticalPosition="middle">
<s:VGroup>
<s:Label text="Are you sure?" />
<s:HGroup>
<s:Button id="_leaveYes"
label="Yes"
click="fetch(MyEvent.LEAVE)" />
<s:Button id="_leaveNo"
label="No"
click="close()" />
</s:HGroup>
</s:VGroup>
</s:Callout>
</fx:Component>
</fx:Declarations>
答案 0 :(得分:0)
我自己解决了PopUpEvent.CLOSE事件的听众:
private var _confirmLeave:ConfirmLeave = new ConfirmLeave();
_confirmLeave.addEventListener(PopUpEvent.CLOSE, handleLeaveCallback);
_confirmLeave.open(this, true);
private function handleLeaveCallback(event:PopUpEvent):void {
if (!event.commit)
return;
fetch(MyEvent.LEAVE);
}