On 4/30/07, Ian Skinner <[EMAIL PROTECTED]> wrote: > Yes, I did mean HBox, there is a VBox container around the label, because > once I have the layout figured out, there will be more then just a label in > it.
So this is what you want: <?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute"> <mx:Panel top="5" bottom="5" left="5" right="5"> <mx:HBox width="100%" height="200"> <mx:Label minWidth="0" width="20%" text="(1) Some very long piece of text." /> <mx:Label minWidth="0" width="20%" text="(2) Some very long piece of text." /> <mx:Label minWidth="0" width="20%" text="(3) Some very long piece of text." /> <mx:Label minWidth="0" width="20%" text="(4) Some very long piece of text." /> <mx:Label minWidth="0" width="20%" text="(5) Some very long piece of text." /> </mx:HBox> </mx:Panel> </mx:Application> Note the setting of minWidth to 0. percentage width/height is really a percentage of the "remaining" width/height *after* all objects have got their minimum widths/heights. In this case, the labels each want to have as much as they need -- more than 20% of the HBox. So the parent container just gives them how much the (say) they need, and, since after that there's no space left, the percentage-based distribution doesn't kick in at all. So in such cases you need to set minWidth/minHeight explicitly. This is not intuitive and one of the most frequent complaints about percentage-based layouts in Flex. > The last minute before I had to leave and catch my train home, I worked up > this solution: > > <mx:Label width="{parentDocument.width/7}" text="{dayCells.currentItem}" > includeInLayout="false" truncateToFit="true" /> Why are you setting includeInLayout to false? That's not what you want, really. Try the solution I suggested and you should be okay. > This works, but I'm a bit confused about the parentDocument, I expected that > to refer to the VBox around the label, but apparently it is referring to > some higher container|control, can somebody provide any insight to what > element this is referring? parentDocument refers to the parent MXML document. In the application, it refers to the application class. In an MXML component, it refers to the root of the MXML document. The documentation for UIComponent explains this in a better way.