When working with NativeWindow
's in AIR, can you get an event everytime the window is minimized / unminimized? I tried hooking up with DisplayStateChanged
but its not firing when the window is minimized. Do you know how to get such an event?
I'm on Windows 7, 32-bit, and I'm running AIR 3.5.
This is the init code:
var init:NativeWindowInitOptions = new NativeWindowInitOptions();
init.maximizable = true;
init.resizable = true;
init.type = NativeWindowType.NORMAL;
init.minimizable = true;
window = new NativeWindow(init);
window.alwaysInFront = true;
window.addEventListener(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGE, dispChange, false, 0, true);
And this is the handler:
private function dispChange(e:NativeWindowDisplayStateEvent):void {
// if minimized / un-minimized
if (e.beforeDisplayState == NativeWindowDisplayState.NORMAL && e.afterDisplayState == NativeWindowDisplayState.MINIMIZED) {
trace("MINIMIZED!");
}else if (e.beforeDisplayState == NativeWindowDisplayState.MINIMIZED && e.afterDisplayState == NativeWindowDisplayState.NORMAL) {
trace("Un-MINIMIZED!");
}
}