Flex Builder defaults some components to "fit to content" if you don't specify a set width or height. I'm trying to fill a mx:Tile component with Actionscript, but the layout has some strange spacing when I don't specify the width of a component I add to it. Is there a way to set the components to "fit to content" using Actionscript?
A:
Do you still need the tiles to align in columns/rows, or do you want them all to be fit-to-content? If you want the former, good luck, and I hope someone else can answer for my benefit. If you want the latter, you could use FlowContainer (which I got from Appdivision).
Jacob
2009-06-15 06:38:47
A:
// AS3 way
var c:UIComponent = <your component that should fit into parent's content>;
c.percentWidth = 100;
c.percentHeight = 100;
// MXML way
<mx:Canvas>
<mx:Button id="c" width="100%" height="100%"/>
</mx:Canvas>
oshyshko
2009-06-22 04:56:48
I'm looking to fit the parent to the children, the mx:Tile component has some odd behavior if I don't specify width such that the components aren't spaced evenly. I thought finding a way to specify "Fit to content" for the parent component might fix it, but this may be another problem entirely.
timbonicus
2009-07-14 21:27:28
ts hard to understand what you mean. Could you edit your question and post a small piece of code so I can copy-paste it and see the problem?
oshyshko
2009-07-16 03:08:46