TextField
687
textColor (TextField.textColor property)
public textColor :
Number
Indicates the color of the text in a text field. The hexadecimal color system uses six digits to
represent color values. Each digit has sixteen possible values or characters. The characters
range from 0 to 9 and then A to F. Black is represented by (
#000000
) and white, at the
opposite end of the color system, is (
#FFFFFF
).
Availability:
ActionScript 1.0; Flash Lite 2.0
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;
textHeight (TextField.textHeight property)
public textHeight :
Number
Indicates the height of the text.
Availability:
ActionScript 1.0; Flash Lite 2.0
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.tex", textWidth: "+my_txt.textWidth);
trace("_height: "+my_txt.", _width: "+my_txt."\n");
my_txt.autoSize = true;
trace("after my_txt.autoSize = true;");
trace("_height: "+my_txt.", _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
Содержание Flash Lite 2
Страница 1: ...Flash Lite 2 x ActionScript Language Reference...
Страница 22: ...22 Contents...
Страница 244: ...244 ActionScript language elements...
Страница 760: ...760 ActionScript classes...