Say I have a layout something like this:
<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.
I don't think you can get Flex containers to handle that. I'd just use a custom UIComponent and have it size its child according to those rules. You can also try SWFLoader/Image as it has a maintainAspectRatio flag.
Flex SDK Developer
Adobe Systems Inc.