FLEX: how to know when the throw PopUpManager Closes dialog is created
Is there an easy way to figure out when the dialog is closing which was created via PopUpManager. I would suspect some type of message or callback mechanism, but it doesn't seem to be happening. In one case, I'm using the WindowTitle component and an event that only fires the CLOSE if someone clicks on close and doesn't give a message when the dialog actually closes.
+2
a source to share
2 answers
Not sure if this is the solution to all needs. But, if you are using TitleWindow, just listen for the close event:
Something like that:
var win : IFlexDisplayObject = PopUpManager.createPopUp(Application.application as DisplayObject, TitleWindow, false) as IFlexDisplayObject;
win.addEventListener(CloseEvent.CLOSE, onClose);
PopUpManager.centerPopUp(win);
And the title box should look something like this:
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" showCloseButton="true" close="closeHandler(event)">
<mx:Script>
<![CDATA[
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
protected function closeHandler(event:CloseEvent):void
{
PopUpManager.removePopUp(this);
}
]]>
</mx:Script></mx:TitleWindow>
+2
a source to share