Monday, September 14, 2009
Saving Data Before Quitting
We just added a long overdue feature to mProjector - onClose and onQuit events that work ;-)
In past versions, these events where implemented but were not fool proof. Sometimes your projector application would quit before receiving or completing the handler code AND they did NOT enable you to abort the event. Now they do.
This added functionality enables you to save data or verify your user's intentions before closing a window or quitting the application.
This feature is in the latest PC release - 4.0.21 - and will be released in the Mac version soon.
In AS2.0, we've implemented this functionality through the mWindow.onClose() and mApplication.onQuit() event handlers. You will return true if you want the action to complete OR false if you need to abort the action.
In AS3.0, we've implemented the functionality by adding CLOSE and QUIT callbacks. If you have registered a function as an mApplication CLOSE callback, the function will be called before the application is quit. If the function returns false, the quit action is aborted and the application remains open.
If you want to look at some code, I just uploaded an AS2.0 sample (EXE, FLAS). The demo has both onClose and onQuit handlers for a parent and child window. Only mWindow.onClose() needs to return true to close the child window whereas both mWindow.onClose() and mApplication.onQuit() must return true for the main window to close.
Oh yeah, you don't include the AS2.0 event handlers or AS3.0 callbacks, the app just quits / window just closes.
B.
In past versions, these events where implemented but were not fool proof. Sometimes your projector application would quit before receiving or completing the handler code AND they did NOT enable you to abort the event. Now they do.
This added functionality enables you to save data or verify your user's intentions before closing a window or quitting the application.
This feature is in the latest PC release - 4.0.21 - and will be released in the Mac version soon.
In AS2.0, we've implemented this functionality through the mWindow.onClose() and mApplication.onQuit() event handlers. You will return true if you want the action to complete OR false if you need to abort the action.
In AS3.0, we've implemented the functionality by adding CLOSE and QUIT callbacks. If you have registered a function as an mApplication CLOSE callback, the function will be called before the application is quit. If the function returns false, the quit action is aborted and the application remains open.
If you want to look at some code, I just uploaded an AS2.0 sample (EXE, FLAS). The demo has both onClose and onQuit handlers for a parent and child window. Only mWindow.onClose() needs to return true to close the child window whereas both mWindow.onClose() and mApplication.onQuit() must return true for the main window to close.
Oh yeah, you don't include the AS2.0 event handlers or AS3.0 callbacks, the app just quits / window just closes.
B.
Labels: ActionScript, mProjector, Sample Code
Subscribe to Posts [Atom]