EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Textheight (Textfield.textheight Property)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
1218 ActionScript classes
Availability: ActionScript 1.0; Flash Player 6
Example
The following ActionScript creates a text field and changes its color property to red.
this.createTextField("my_txt", 99, 10, 10, 100, 300);
my_txt.text = "this will be red text";
my_txt.textColor = 0xFF0000;
The MovieClip.getNextHighestDepth() method used in this example requires Flash Player
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
MovieClip.getNextHighestDepth() method.
textHeight (TextField.textHeight property)
public textHeight : Number
Indicates the height of the text.
Availability: ActionScript 1.0; Flash Player 6
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
textWidth (TextField.textWidth property)

Table of Contents

Related product manuals