6 Replies Latest reply on Aug 3, 2007 12:33 PM by jfillman

    How to maximize window?

    msabljic Level 1
      What i am trying to do is to maximize application window when application starts and my whole application is inside a Panel with other controls.
      How can this be done?

      thank you
        • 1. Re: How to maximize window?
          jfillman Level 1
          Are you trying to maximize the application within the browser or maximize the browser? If you are trying to maximize the brower, I don't believe that is possible from a SWF.

          If you don't specify a height and width for the application, then your application should default to the maximum size of the browser or the Flash Player. If you are using AIR, simply call a function on creationComplete and use maximize();

          If you are saying you want to maximize the panel itself, this can be done several ways. The best way is to set the left, top, bottom, and right properties of your panel all equal to zero.

          Otherwise, you'll have to be more specific as to what you are atttempting.
          • 2. Re: How to maximize window?
            msabljic Level 1
            I am trying to maximize AIR application and i set function with

            stage.window.maximize();

            statement in my panel's creationComplete property but all i got was this error:

            Error #1009: Cannot access a property or method of a null object reference.

            so i am not sure what's going on?

            thanks for your help
            • 3. Re: How to maximize window?
              jfillman Level 1
              You should do this at the application level, not in the panel.

              For example:

              <mx:WindowedApplication xmlns:mx=" http://www.adobe.com/2006/mxml" applicationComplete="initApp();" layout="absolute" >

              private function initApp():void{
              maximize();
              }

              You could also go with the full screen option:

              private function initApp():void{
              stage.displayState = StageDisplayState.FULL_SCREEN;
              }

              However, if you have to do this from within the panel, you should use:

              this.maximize();
              • 4. Re: How to maximize window?
                msabljic Level 1
                I see, that's where was my mistake i suppose. I'll give that a try.

                thank you very much for your help,
                chhers
                • 5. Re: How to maximize window?
                  msabljic Level 1
                  Just wanted to say that your both suggestions worked like a charm. What i would like to know is why the following statement:

                  stage.window.maximize();

                  didn't work at the first place, what's wrong with it?

                  thanks once again
                  • 6. Re: How to maximize window?
                    jfillman Level 1
                    You could also do window.maximize(); from the panel event or the creationComplete event.

                    The window is the primary container in AIR applications. The window contains, and thereby, controls the stage. The StageDisplayState controls the AIR runtime and/or the Flash Player directly, overriding the window. It would seem more appropriate for this to be available to the window container, but I'm sure Adobe has a good reason for it, maybe :-)