Flash Lite 2.x and 3.0 ActionScript Language Reference

textHeight (TextField.textHeight property)

public textHeight : Number

Indicates the height of the text.

Example

The following example creates a text field, and assigns a string of text to the field. A trace statement is used to display the text height and width in the Output panel. The trace() method is used to write the text height and width in the log file. The autoSize property is then used to resize the text field, and the new height and width will also be displayed in the Output panel.The autoSize property is then used to resize the text field, and the new height and width also write to the log file.

this.createTextField("my_txt", 99, 10, 10, 100, 300);
my_txt.text = "Sample text";
trace("textHeight: "+my_txt.textHeight+", textWidth: "+my_txt.textWidth);
trace("_height: "+my_txt._height+", _width: "+my_txt._width+"\n");
my_txt.autoSize = true;
trace("after my_txt.autoSize = true;");
trace("_height: "+my_txt._height+", _width: "+my_txt._width);

Which outputs the following information:

textHeight: 15, textWidth: 56
_height: 300, _width: 100

after my_txt.autoSize = true;
_height: 19, _width: 60

See also

textWidth (TextField.textWidth property)