Don't like ads? PRO users don't see any ads ;-)
Guest

Create new window in Air Application

By: a guest on Apr 8th, 2012  |  syntax: None  |  size: 0.89 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <mx:WindowedApplication ...>
  2.    <p:YourComponent ... />  <!-- by putting it in your own file you can reuse it -->
  3. </mx:WindowedApplication>
  4.        
  5. <mx:Canvas ...>
  6.    <!-- put the contents that's in WindowedApplication here -->
  7.  
  8.    <!-- add this block to your script block, and hook up a button/menu/whatever to
  9.         invoke this function.  See how it creates a new instance of Window, adds a
  10.         new instance of YourComponent (which is the guts of your app), and shows that.
  11.     -->
  12.    <mx:Script>
  13.        private function createNewWindow() : void {
  14.            var window : Window = new Window();
  15.            var yourComponent : YourComponent = new YourComponent();
  16.            // initialize yourComponent instance's properties
  17.  
  18.            window.addChild( yourComponent );
  19.            window.width = 800;
  20.            window.height = 600;
  21.            window.open(true);
  22.        }
  23.    </mx:Script>
  24. </mx:Canvas>