Search code examples
apache-flexairflash-builder

Flex - how to get a list of Air Window titles that are currently open (or check for a specific window title)?


In my Flex (Flash Builder 4.6) application, I am opening an Adobe AIR "Window" object, via:

myWindowObject = new MyWindow(); // this is a "" myWindowObject.title="custom window title here"; myWindowObject.open;

In the application, the user may open several windows. I need to prevent the user from opening the same window twice. So I either need an ability to check for the existence of a window currently open with a specific title, OR get a list of all the open windows, and then I could look at that list to see if it's already open.

How can I get a list of the window titles, or check for a window with a specific title?


Solution

  • The Air framework provides an Array of all opened windows:

    FlexGlobals.topLevelApplication.nativeApplication.openedWindows;

    You can iterate through these and check the title of each and do with it as you wish.