I've got the following code:
var foo:Label = new Label();
foo.text = data.toString();
trace(data.toString() + " = " + foo.textWidth);
However, it never calculates the proper text width. I'm getting this on the console:
Smooth = NaN
Surprised = NaN
Inspired = NaN
Excited = NaN
Refreshed = NaN
Sexy = NaN
The ultimate goal is to present a HorizontalList where each item has a different width, sized to the width of the word being displayed.
HorizontalList does not support variable renderer widths. If you don't have
a lot of items, put them in an Hbox.
I think you are getting NaN because you didn't addCHild(foo)
I used an HBox and Repeater to create the effect. I never figured out why the textWidth wasn't being set - I was calling validateNow as stated in the docs.