Is it possible to have multiple windows-"handles" open in one Adobe AIR application? You can ofcourse make a walkaround by letting the app be transparent, but I am interested in a better solution.
+4
A:
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
. Then, in your main class you create as many Window
instances as you want.
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>
Theo
2009-10-04 16:10:34
I don't quite understand you could you post some very basic mxml/as3 code?
sigvardsen
2009-10-04 16:45:59
Are you using Flash-builder? Because the Flex 4 SDK won't accept it. It returns G:\FOREX\src\Main.mxml(6): Error: Type was not found or was not a compile-time constant: Window.
sigvardsen
2009-10-05 08:58:31
Could you rewrite you sample to as3? There I can import Window etc.
sigvardsen
2009-10-05 10:00:35
A:
Why do you want window "handles" ?
The PopupManager lets you create non-modal windows.
Cheers
Richard Haven
2009-10-05 02:05:17
I don't want an "in application" window. I want a completely new native window.
sigvardsen
2009-10-05 09:58:58
You want an AIR application to create GUI objects outside the AIR runtime?I think that goes against the idea of AIR: a contained, managed application environment that has limited access and interaction with the OS.Cheers
Richard Haven
2009-10-09 21:55:59
+1
A:
The following will do the trick (It is Theo's code just corrected a bit):
<?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>
sigvardsen
2009-10-05 11:23:18
A:
you can see this thread related to opening multiple windows in Adobe AIR application http://askmeflash.com/qdetail/837/how-to-open-multiple-window-in-adobe-air-app
Robert
2010-06-10 17:55:48