User Guide

928 Chapter 2: ActionScript Language Reference
TextField.textHeight
Availability
Flash Player 6.
Usage
my_txt.textHeight:Number
Description
Property; 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
autoSize
property is then used to resize the text field, and the new height and width will also be displayed
in the Output panel.
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
TextField.textWidth