3 Replies Latest reply on Jun 11, 2008 1:06 PM by Gregory Lafrance

    Centering Forms

      I am trying to figure out how to center a form, or a panel that a form sits on, in the browser window, so that as you resize your browser window, the form will adjust to always be centered.
      I am on version 2.0.1.
      I know that there is a way to lock your panel edges, but now I can't even find the controls to do that. Perhaps I saw it while trying a demo of a different version of Flex.?
      Any ideas or links to articles that would help me figure this out would be greatly appreciated!
        • 1. Re: Centering Forms
          Gregory Lafrance Level 6
          <?xml version="1.0"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
          verticalAlign="middle" horizontalAlign="center">
          <mx:Panel backgroundColor="#ccffcc">
          <mx:Form id="myForm" defaultButton="{mySubmitButton}">
          <mx:FormItem label="Zip Code">
          <mx:TextInput id="zipCode"/>
          <mx:FormItem label="Phone Number">
          <mx:TextInput id="phoneNumber"/>
          <mx:Button label="Submit" id="mySubmitButton"/>
          • 2. Re: Centering Forms
            Thank you, Greg.
            That was just what I needed!

            Do you know how to lock the edge of a panel to the bottom and/or right side?
            I've done it before, but I can't seem to find it now. Perhaps it was in a different version of Flex.
            • 3. Re: Centering Forms
              Gregory Lafrance Level 6

              Constraint based layout. Flex 3 now allows you to also use constraint based layout relative to siblings.

              Check out this FB3 help topic:

              Using constraints to control component layout
              1 person found this helpful