AIR: List of all opened windows
I was hunting around today for all opened windows in my application. Seemed obvious enough and something Adobe would have included in the environment — and they did. But it was not something simple to find a reference to, so I thought I’d throw this post out there in the ether. Maybe someone else will find it useful.
var windows:Array = NativeApplication.nativeApplication.openedWindows;
Beautiful. And this opens up some other interesting possibilities:
Represents this native AIR application.
The
NativeApplicationclass provides application information, application-wide functions, and dispatches application-level events.
NativeApplicationis a singleton object, created automatically at application startup. Get the NativeApplication instance of an application with the static propertyNativeApplication.nativeApplication.(from the api)
There are some interesting items in there:
- activeWindow : NativeWindow
[read-only] Returns the application window that is currently active. - applicationDescriptor : XML
[read-only] The contents of the application descriptor file for this AIR application. - icon : InteractiveIcon
[read-only] The application icon. - supportsSystemTrayIcon : Boolean
[static] [read-only] Specifies whether AIR supports system tray icons on the current operating system. - timeSinceLastUserInput : int
[read-only] Returns the time, in seconds, since the last mouse or keyboard input. - exit(errorCode:int = 0):void
Terminates this application. - undo():Boolean
Invokes an internal undo command on the focused display object.
Of course I was already using several of these for my tray-icon and menus and such, but I didn’t know the window list was in here too.
Leave a Reply