Question

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 ?
}
Was it helpful?

Solution

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();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top