How to access NativeWindow's wrapper class (mx:Window) property from NativeWindow object

253 views Asked by At

Lets say I have Window component named myCustomWindow. Then I create new windows with:

var newWindow:myCustomWindow = new myCustomWindow();
newWindow.open();

myCustomWindow has public property named myProperty.

How to access myCustomWindow from NativeWindow? For example, how to do it in this loop:

for (var i:int = 0; i < NativeApplication.nativeApplication.openedWindows.length; i++) 
{
    if( NativeApplication.nativeApplication.openedWindows[i].myProperty == 25)
    {
          NativeApplication.nativeApplication.openedWindows[i].close();
    } 
    //error, cause NativeWindow doesn't have myProperty
    //how to access myCustomWindow.myProperty of this NativeWindow ?
}
1

There are 1 answers

0
Nemi On BEST ANSWER

This is one solution:

Create array and push() all windows in.

var myWindowsArray:Array = [];
...
myWindowsArray.push(myCustomWindow);

Accessing myProperty:

for each (var k:myCustomWindow in myWindowsArray) 
{
    if( k.myProperty == 25)  k.close();
}