2

Air Project で新しいウィンドウ (同じアプリケーションの複製) を作成する方法。誰でも助けてくれてありがとう。

4

1 に答える 1

1

mx:Window を使用して、コードを mx:WindowedApplication から取り出し、再利用可能な Canvas に配置します。そのインスタンスを mx:WindowApplication に戻すと、新しい mx:Window を作成して、再利用可能な Canvas コンポーネントもそこに追加できます。

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

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>
于 2011-07-27T14:57:37.520 に答える