Using ActionScript, I want to add a Label to a VBox.  I know what text I want 
to put into the label (said text is read from an XML file), but of course, the 
program cannot know what the width of the label should be until after the text 
is read from that XML file.  I want the label to be as wide as it needs to be, 
but not wider than the vBox I'm adding it to -- if that label will need to be 
wider than the given amount to display all the text, then I want to add a 
TextArea (with word-wrap turned on) so I can display all the text in that given 
width.

My question is, how do I calculate the width of a label I'll need, when given a 
string of text?  I do know the font-family and font-size the label will have.  
Is there an easy way to go from a string of text to the width that a label will 
need to be to display that text?

Thanks,
Laurence MacNeill
Mableton, Georgia, USA


Reply via email to