2 Replies Latest reply on Jan 16, 2007 7:35 AM by rwtemple

    Layout container choices

      I'm looking for a container in Flex that allows me to put a child on the left, and child on the right and a child in the center that expands to fill all the remaining space that the left and right children didn't use. In Java I would use a BorderLayout to do this. I haven't found anything like this in the standard containers. Do I have to roll my own, or am I overlooking something?

      I could also use a container that lays out children relative to each other. i.e. I'd like to specify the right side of one child always lines up with the left side of another child. Is this possible?

        • 1. Re: Layout container choices
          FlightGuy Level 1
          I would think you'd be fine just using an HBox with the three components. Set the width of the left and right components to their fixed values, and use a percent width for the center component. You can set its width to 100%.

          Alternatively, use a Canvas with constraint-based layout, in which you can set your center component to be sized by x1 units from the left and x2 units from the right.

          If the center component may grow and shrink, and you want it to remain centered,

          <HBox width="500>
          <Component id="left"/>
          <HBox width="100%" horizontalAlign="center">
          <Component id="variableSizeCentered"/>
          <Component id="right"/>

          • 2. Re: Layout container choices
            rwtemple Level 1
            Hi Tim,

            I tried the HBox, my middle component is larger then the space available so it ends up filling all the remaining space and because I turned off scrollbars in the HBox, the last component doesn't show up at all.

            I'll try the Canvas solution,