Yes, I had it too. But itโs actually quite simple to intercept and prevent the closure.
Beware that this code will prevent the closing of the standard window! I do not recommend using it without adding a confirmation dialog or closing the code instead of a comment.
stage.nativeWindow.addEventListener(Event.CLOSING, onCloseCall); function onCloseCall(evt:Event):void { evt.preventDefault();
Now, how to show a warning message (aka dialog box) is completely up to your platform, method and needs. For example, if you use Flash Professional, a custom movie clip that you hide and show can do the trick. However, if you use Flex, there are ways to create a modal dialog. Learn it separately.
CodeMouse92
source share