2

Hey! I try to find out the text size of a textfield in the following example

field.text = 'aaaaaaa';
trace(field.textWidth);

setTimeput(function(){
   field.text = 'aa';
   trace(field.textWidth);
},2000)

The number is always the same. Why? I need the text width so I can adjust size for a background movieclip. Thx!

xpepermint
  • 35,055
  • 30
  • 109
  • 163

2 Answers2

0

You might want to try the TextLineMetrics class. It could get you close enough. I've used it a few times and its accurate.

Alex Jillard
  • 2,792
  • 2
  • 19
  • 20
0

You also have a typo on line 4. "setTimeput" instead of "setTimeout."

novwhisky
  • 446
  • 3
  • 14