views:

310

answers:

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!

A: 

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
A: 

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

Nathan Witt