1 Reply Latest reply on Feb 7, 2012 7:32 PM by redefy

    NativeWindowInitOptions.owner

    redefy

      Hello. Sorry for my English.


      I have got a problem.


      I want to make the main window of the owner of all other windows. Well, that is, that if the main window is minimized, then with it minimizes all the others.


      But. If I'm not doing this for the main window, such as

       

      package {

           import flash.desktop.NativeApplication;

           import flash.display.NativeWindow;

           import flash.display.NativeWindowInitOptions;

           import flash.display.NativeWindowRenderMode;

           import flash.display.NativeWindowSystemChrome;

           import flash.display.NativeWindowType;


           import flash.display.Sprite;

           import flash.display.StageAlign;

           import flash.display.StageScaleMode;


           / **

           * Working with windows in AIR

           * @ Author redefy

           * /

           public class Main extends Sprite {


                public function Main (): void {

                     stage.scaleMode = StageScaleMode.NO_SCALE;

                     stage.align = StageAlign.TOP_LEFT;

                     stage.color = 0x0;


                     var mainWindowsOption: NativeWindowInitOptions = new NativeWindowInitOptions ();

                     / / mainWindowsOption.owner = this.stage.nativeWindow;


                     var mainWindow: NativeWindow = new NativeWindow (mainWindowsOption);

                     mainWindow.stage.color = 0x1b1b1b;

                     mainWindow.width = 400;

                     mainWindow.height = 300;

                     mainWindow.stage.scaleMode = StageScaleMode.NO_SCALE;

                     mainWindow.stage.align = StageAlign.TOP_LEFT;

                     mainWindow.activate ();


                     var windowsOption: NativeWindowInitOptions = new NativeWindowInitOptions ();

                     windowsOption.owner = mainWindow;

                     windowsOption.type = NativeWindowType.UTILITY;


                     var window: NativeWindow = new NativeWindow (windowsOption);

                     window.stage.color = 0xcccccc;

                     window.width = 200;

                     window.height = 200;

                     window.activate ();


                     trace (NativeApplication.nativeApplication.openedWindows);

                }

           }

      }

       

       


      So everything is OK. If you minimize the window first, then the second is minimized as well. That is as it should be.


      But if the line remove comment


       

      mainWindowsOption.owner = this.stage.nativeWindow;

       


      , That is to make the main window of the owner first, then the windows except the main, are not shown.


      although


       

      trace (NativeApplication.nativeApplication.openedWindows);

       


      as the situation of returning links to three windows.


      I can not understand the reason for such behavior.