2 Replies Latest reply on Feb 10, 2010 4:59 PM by Flex harUI

    Label textWidth

    jsd99 Level 3

      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.