1 person found this helpful
you can listen the close event on the windowApplication.
In the listener, you stop the closing with event.preventDefault()
Then you show your alert message
How can I listen to the windowApplication? I mean it has no id..could I you write a small example maybe?
If it's an mxml component :
<s:WindowedApplication closing="closeHandler(event)" />
If it's an AS3 component extending WindowApplication:
(check the syntax there may be typo)
Thank you very much! that's the solution. I was wondering myself why I didn't get it, b
ecause it's not really difficult.
Now I have the problem that the application still closes. My Code looks like this:
<?xml version="1.0" encoding="utf-8"?>
protected function windowedapplication1_closeHandler(event:Event):void
<!-- Place non-visual elements (e.g., services, value objects) here -->
Maybe this Event is not stoppable?
try "closing" event instead of "close"
(and try more than 1min before posting, or you will always wonder why you didn't find yourself )
Flex documentation is often usefull : http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Window edApplication.html
Here you can see "close" is dispatched AFTER the window has been closed, whereas "closing" is dispatched BEFORE, so you can still prevent it.