4 Replies Latest reply on Mar 1, 2009 8:10 AM by garry.b

    Browser window dimensions?

    garry.b
      Hi,

      How can my Flex application get the dimensions of the browser window in which it's contained? I'm sure I've seen
      something similar posted here but can't turn it up in a forum search. I know about BrowserManager but that seems
      to provide access to URL properties only. I have used ExternalInterface to call JavaScript functions but am not
      sure if or how to use it to get browser properties. This is a browser DOM thing, right?

      Thanks, Garry
        • 1. Re: Browser window dimensions?
          Francisc Level 3
          I am not sure how to use BrowserManager for that, however, if you know how to write a function in JavaScript that will give you the dimentions of the window, you can just all that function using ExternalInterface.

          I can look around for such JS functions if you are not sure how to write them yourself.
          • 2. Re: Browser window dimensions?
            garry.b Level 1
            Hi,

            Yes, I can do the ExternalInterface thing but as getting window information seems a common operation I want to be sure I'm not overlooking an existing Flex 3 solution.

            Thanks, Garry
            • 3. Re: Browser window dimensions?
              Level 7

              "garry.b" <webforumsuser@macromedia.com> wrote in message
              news:goe8fp$bh0$1@forums.macromedia.com...
              > Hi,
              >
              > Yes, I can do the ExternalInterface thing but as getting window
              > information seems a common operation I want to be sure I'm not overlooking
              > an existing Flex 3 solution.
              >

              faBridge?


              • 4. Re: Browser window dimensions?
                garry.b Level 1
                Hi,

                Answering my own question here. You can get the dimensions of the Application window using the systemManager property like this:

                systemManager.screen.top;
                systemManager.screen.height;
                // etc

                If the Application is sized using relative percentages, those numbers will be a good approximation of the browser window size. If *not* using relative percentages, then the Application window size is fixed, SystemManager will always report the same size and you'll need to call into Javascript to obtain the browser window size. Hope that's clear.

                Garry