This content has been marked as final. Show 3 replies
Any reason you are using Label instead of Text?
The Text component will collapse to the size of what is in it but the label will have space on the right which is where your extra space is coming from.
The label does this as part of it's standard formatting to allow it to stand off a bit from whatever it is labeling without you having to add extra formatting.
If you switch your labels to simply Text components I believe you will find you get the effect you want.
Well, firstly because of this from http://livedocs.adobe.com/flex/3/langref/mx/controls/Text.html
The Text control displays multiline, noneditable text. Use the Label control if you need only a single line of text.
But Text seems unnecessarily complicated with the whole childnode thing. (btw, can you tell I'm new to Flex?)
is the padding not adjustable on Label?
I tip my hat to anyone who has actually read the livedocs first before posting here. In most cases I would also suggested to follow the API.
In this case however I would still suggest using Text as long as you understand how it will react if your HBox gets too small. I.E. it will wrap unless you have set the width to a percentage.
Text subclasses Label but handles the space around itself the way I believe you are thinking a label should.
The label control is more of a container that has text in it and the minimum size of the container does not honor the dimensions of the font once the width gets smaller then the height. Instead it just tends to end up square at that point. Text control honors the spacing around the font of the item inside it.
So for example if there was a single character "1" in a label control with your CSS options above the width of the label control itself will be the same as the height of the character plus the top and bottom padding. But in a Text control the width is the width of the font of the character plus the left and right padding.
Not sure if that is how it was intended but in my experience that is how it displays.
(Sorry did not intend to explain so much just to say I still would use text.)