1 Reply Latest reply on Jul 25, 2007 6:10 AM by jason_v2

    How do I use the Label textWidth property??

    jason_v2
      Hey all,

      I have a very simple label in which I'm trying to grab the textWidth property from. Here is the code:

      var display:Label = new label();
      display.text = "A";
      display.validateNow();
      var characterWidth:Number = display.textWidth;

      When I debug, I see that the textWidth property of display is always NaN.... What's going on here??
        • 1. Re: How do I use the Label textWidth property??
          jason_v2 Level 1
          So instead of a label I also tried using a TextField. I also created a TextFormat object to set the fontFamily and fontSize to "Lucida Console" and "10". My guess was that it would pick up the fixed width Lucida Console font when I called the textWidth property. However, comparing the textWidth of two different characters shows that this is not true.

          Has anyone come across this before??