1 Reply Latest reply on Aug 1, 2009 11:05 PM by Flex harUI

    Semi-greedy UIComponent size

    Scott Sheehan

      Say I have a layout something like this:

      <vbox width="100%">

        <hbox><spacer/><my component/><spacer/></hbox>

        <hbox> ... (more components) ... </hbox>



      "my component" has a (scalable) graphic that has a 2:1 width to height ratio. I'd like it to take up as much space as possible, but at the same time take no more than it needs. So for example, if the entire available space (to the vbox) is 1000x1000 pixels, my component would say it takes up 1000x500. If the space available is 1000x50, it will say it only takes up 100x50 (and the spacers take up 450 each on the sides).


      How can I do this? I've tried returning various things from measure(), but the parent's width & height aren't set at that time.