Can you listen for a hide event?
No. Attaching a listener for that event to the modal window does not work -- it's never dispatched to the listener. It's a fairly ugly issue. The way I've kludged it for now is to create a window queue that, when populated, activates a timer. The timer sweeps the queue looking for native windows that are no longer visible then invokes close on the Flex wrapper object.
But it's even more complicated than that, of course, because, as you might expect, certain cancel button click handlers have to perform clean-up ops and so forth...so in an even uglier kludge, the swept window is introspected for cancel buttons and then an artificial click event is sent to the button. Ugh...let me know if you have any other insight, but thanks for the response.
Clearly the best solution would be to let the plug in window receive the key down event.
1 person found this helpful
No much different than your "solution", but you can create your own window manager. When you open a window, you register it with the manager, which in turn checks to see if it closes.
Probably a better way to do it would be to start a timer when the modal window opens that checks every second or so if the window is visible. If not, it could call you close() method. That way a window would be responsible to close itself...
Either way, it's good to know about this issue, because I'm probably going to have to work around it myself...
Well, I do have a pseudo window manager -- that's the guy responsible for the timer. It maintains an independent queue where windows are "registered" and "unregistered"....but I take your point. I do like your approach better, I just had to get something up and running for an interim release.