3 Replies Latest reply on Jan 7, 2010 6:29 AM by FinFlex

    How to center application window

    webvalue Level 1
      I have an application that has to be sized at 1024 x 768. It also needs to be centered in the browser window no matter how big the browser window becomes. I tried to set everything's (HBox, Canvas, etc.) horizontalAlign to be "center", but it still is algined to the left. Does anyone have any solution for this problem?

        • 1. Re: How to center application window
          ProfessorC Level 1
          How 'bout, rather than trying to center the app in Flex itself, use some CSS in the HTML template to center the EMBED/OBJECT tags.

          Or, if you get really desperate, use Javascript to determine the window content width and height and centering the Flex SWF that way.

          Since the application is the root level, it's always going to appear at the relative coordinates of the EMBED tag (typically 0x0y). If you're bent on positioning/centering your entire UI in Flex alone, you're going to have to put it in a child container (like a canvas or panel or vbox) and position THAT. The drawback is that you're going to get Flex scrollbars rather than browser scrollbars.
          • 2. Re: How to center application window
            Ansury Level 3
            Can't you just use <center></center> tags? Isn't the Flex object just dropped into an HTML/JSP/etc page?

            I haven't messed with Flex in a browser much (more of an AIR user here), so nevermind if that's way off.
            • 3. Re: How to center application window

              It's not working like that.