假设我有一个名为myCustomWindow的Window组件。然后我用:
创建新窗口var newWindow:myCustomWindow = new myCustomWindow();
newWindow.open();
myCustomWindow具有名为myProperty的公共属性。
如何从NativeWindow访问myCustomWindow? 例如,如何在此循环中执行此操作:
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 ?
}
答案 0 :(得分:0)
这是一个解决方案:
创建数组并推送()所有窗口。
var myWindowsArray:Array = [];
...
myWindowsArray.push(myCustomWindow);
访问myProperty:
for each (var k:myCustomWindow in myWindowsArray)
{
if( k.myProperty == 25) k.close();
}