[英]Multiple Windows in Adobe AIR
Is it possible to have multiple windows-"handles" open in one Adobe AIR application? 是否可以在一个Adobe AIR应用程序中打开多个窗口-“句柄”? You can ofcourse make a walkaround by letting the app be transparent, but I am interested in a better solution.
您当然可以通过使应用程序透明来解决问题,但我对更好的解决方案感兴趣。
The best way to handle this is to make the main class a subclass of Application
instead of WindowedApplication
, and set the initialWindow
s visible
setting to false
. 解决此问题的最佳方法是使主类成为
Application
的子类,而不是WindowedApplication
,并将initialWindow
的visible
设置设置为false
。 Then, in your main class you create as many Window
instances as you want. 然后,在您的主类中创建所需的多个
Window
实例。
Main class: 主班:
<Application xmlns="http://www.adobe.com/2006/mxml">
<applicationComplete>main()</applicationComplete>
<Script>
<![CDATA[
private function main( ) : void {
var window : Window;
for ( var i = 0; i < 5; i++ ) {
window = new Window();
window.width = 200;
window.height = 300;
window.open(true);
}
}
]]>
</Script>
</Application>
App config: 应用配置:
<application xmlns="http://ns.adobe.com/air/application/1.5">
...
<initialWindow>
...
<visible>false</visible>
</initialWindow>
</application>
The following will do the trick (It is Theo's code just corrected a bit): 以下将解决问题(这是Theo的代码刚刚更正了一点):
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="main()">
<mx:Script>
<![CDATA[
import mx.core.Window;
private function main( ) : void {
var window:Window;
for ( var i:int = 0; i < 5; i++ ) {
window = new Window();
window.width = 200;
window.height = 300;
window.open(true);
window.showStatusBar = false;
}
}
]]>
</mx:Script>
</mx:Application>
Why do you want window "handles" ? 为什么要窗口“句柄”?
The PopupManager lets you create non-modal windows. PopupManager允许您创建非模式窗口。
Cheers 干杯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.