I’m porting an AS3/Spark/Air app that supports multiple windows based on spark.components.Window. Working with the OpenFL NativeWindow, I’m currently stuck trying to understand how to detect two events. The Spark equivalents are:
-
creationComplete: when the window is available for the first time. The available NativeWindow events (active, etc.) seem to reoccur throughout the app lifetime. I guess I could set a firstActivate flag if that would be the recommendation.
-
closing: before the window closes in order to intervene in case there is unsaved work. I see the advice in the NativeWindow doc to “manually dispatch a
closing
event”, but the question is “Where?” If the window is closed manually by the user clicking the close box, there does not seem to be an opportunity to intervene before OpenFL NativeWindow.window_onClose gets called, cleans up, and dispatched it’s own close event. Adding my own lime close event listener to the private NativeWindow.window.__window or overriding the private NativeWindow.window_onClose don’t seem to be options either.
Thanks, any help appreciated.