TextField.textColor Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
TextField.textColor Property Flash 6

sets the color for all characters in the text field read/write
theField.textColor

Description

The integer textColor property is a convenience property for quickly setting the color of the text (not the background color) for an entire text field with minimal fuss. It defaults to black (i.e., hex 0x000000). The following code makes the title_txt field red:

this.createTextField("title_txt", 1, 0, 0, 200, 20); title_txt.text = "The Story of Princess Gwendolyn"; title_txt.textColor = 0xFF0000;

To set the background color, use the backgroundColor property. To color and format text on a character-by-character basis, use setTextFormat( ) or htmlText instead. Any assignment to textColor overwrites specific character color information contained in the field's htmlText property or TextFormat objects. Once textColor is set, all subsequent text appears in the specified color. Functionally, assigning textColor is identical to creating a TextFormat object with a color property set, then applying that format to the entire field with setTextFormat( ) and also applying it to any new text with setNewTextFormat( ). The value of textColor is also reflected in htmlText if the html property is true.

See Also

The Color class, TextField.backgroundColor, TextField.borderColor, TextField.html, TextField.htmlText, TextField.setNewTextFormat( ), TextField.setTextFormat( )



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net