简体   繁体   English

在Air Application中创建新窗口

[英]Create new window in Air Application

how to create new window(same application duplicate) in Air Project. 如何在Air Project中创建新窗口(相同的应用程序重复项)。 Any one Help thanks. 任何人都谢谢。

Use mx:Window, and take your code out of mx:WindowedApplication and put it into a reusable Canvas. 使用mx:Window,然后将代码从mx:WindowedApplication中取出,并将其放入可重用的Canvas中。 The put an instance of that back in mx:WindowApplication, and then you can create a new mx:Window and add your reusable Canvas component in there as well. 将其实例放回到mx:WindowApplication中,然后您可以创建一个新的mx:Window并在其中添加可重用的Canvas组件。

<mx:WindowedApplication ...>
   <p:YourComponent ... />  <!-- by putting it in your own file you can reuse it -->
</mx:WindowedApplication>

In a separate file called YourComponent.mxml: 在一个名为YourComponent.mxml的单独文件中:

<mx:Canvas ...>
   <!-- put the contents that's in WindowedApplication here -->

   <!-- add this block to your script block, and hook up a button/menu/whatever to 
        invoke this function.  See how it creates a new instance of Window, adds a
        new instance of YourComponent (which is the guts of your app), and shows that.
    -->
   <mx:Script>
       private function createNewWindow() : void {
           var window : Window = new Window();
           var yourComponent : YourComponent = new YourComponent();
           // initialize yourComponent instance's properties

           window.addChild( yourComponent );
           window.width = 800;
           window.height = 600;
           window.open(true);
       }
   </mx:Script>
</mx:Canvas>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM