I'm trying to add an inline Callout to my networked flex mobile app which would ask the user - if she is really sure, that she wants to leave a chat room.
However I get the compiler error - because the (non-static) function fetch(MyEvent.LEAVE)
below belongs to the parent View.
Is there still a way to call it (maybe through an outerDocument
, parent
, owner
or smth. similar)?
<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>
Solved it myself with a listener for PopUpEvent.CLOSE event:
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);
}