03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

textColor (TextField.textColor property)<br />

public textColor : Number<br />

Indicates the color of the text in a text field. The hexadecimal color system uses six digits to<br />

represent color values. Each digit has sixteen possible values or characters. The characters<br />

range from 0 to 9 <strong>and</strong> then A to F. Black is represented by (#000000) <strong>and</strong> white, at the<br />

opposite end of the color system, is (#FFFFFF).<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Example<br />

The following <strong>ActionScript</strong> creates a text field <strong>and</strong> changes its color property to red.<br />

this.createTextField("my_txt", 99, 10, 10, 100, 300);<br />

my_txt.text = "this will be red text";<br />

my_txt.textColor = 0xFF0000;<br />

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player<br />

7 or later. If your SWF file includes a version 2 component, use the version 2 components'<br />

DepthManager class instead of the MovieClip.getNextHighestDepth() method.<br />

textHeight (TextField.textHeight property)<br />

public textHeight : Number<br />

Indicates the height of the text, in pixels.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Example<br />

The following example creates a text field, <strong>and</strong> assigns a string of text to the field. A trace<br />

statement is used to display the text height <strong>and</strong> width in the Output panel. The autoSize<br />

property is then used to resize the text field, <strong>and</strong> the new height <strong>and</strong> width will also be<br />

displayed in the Output panel.<br />

this.createTextField("my_txt", 99, 10, 10, 100, 300);<br />

my_txt.text = "Sample text";<br />

trace("textHeight: "+my_txt.textHeight+", textWidth: "+my_txt.textWidth);<br />

trace("_height: "+my_txt._height+", _width: "+my_txt._width+"\n");<br />

my_txt.autoSize = true;<br />

trace("after my_txt.autoSize = true;");<br />

trace("_height: "+my_txt._height+", _width: "+my_txt._width);<br />

Which outputs the following information:<br />

textHeight: 15, textWidth: 56<br />

_height: 300, _width: 100<br />

1238 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!