Adobe AIR: Listen to the Display State Changing of the Window
It’s a useful feature to be able to know when an AIR window is minimized, maximized or restored (set to normal). Most of this code is gleaned from a much more robust script at Jeffry Houser’s blog. It’s also handy to check out Adobe’s documentation on this topic (which is far less robust). The states of interest are:
· NativeWindowDisplayState.NORMAL
· NativeWindowDisplayState.MINIMIZED
· NativeWindowDisplayState.MAXIMIZED
// Create an event listener for the display state of an AIR application
stage.nativeWindow.addEventListener(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING, myDisplayState);
function myDisplayState(displayStateEvent:NativeWindowDisplayStateEvent):void {
// if the window was previously minimized, but is now being restored to normal
if (displayStateEvent.afterDisplayState == NativeWindowDisplayState.NORMAL && displayStateEvent.beforeDisplayState == NativeWindowDisplayState.MINIMIZED) {
// Code here...
}
}
0 Comments:
Posta un commento
<< Home