2 Replies Latest reply on Jul 3, 2007 4:39 AM by Robert Hirst

    Support for multiple resolutions

    bahlsonal
      Hi, i currently have a website created 100% in Flex that has elements centered on the page - annoyingly enough (but not surprisingly) the page renders differently at different resolutions. At 1024x768 for example, some elements are completely cut off, while at higher resolutions, the elements are shifted to the far left or right.

      Is there a way to adapt the site to multiple resolutions using Flex? I know there's a "Fit to window" approach, but is there a way to do 1 layout for 1 resolution, save it as a state, detect another resolution and display another saved state? That would be so convenient. Please help asap.

      Thank you.
        • 1. Re: Support for multiple resolutions
          in your html wrapper set the style for html and body to height: 100%; and width: 100%;

          then in your embed/object code set the width/height to 100% also.

          now, in your flex application, to center an item, set its center offset to 0 and its vertical center offset to 0

          To do this

          <mx:Control horizontalCenter="0" verticalCenter="0"/>
          • 2. Re: Support for multiple resolutions
            Robert Hirst
            I don't know if you can detect the screen resolution in Flex, just the actual window size. I may be wrong.

            But I'm pretty sure you can detect screen resolution with Javascript. You could try doing the resolution detection using javascript in the html wrapper and passing the detected resolution into Flex. Then make a creationcomplete for the application, and look at the var to set the state appropriately.