TextFormat.bold Property

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

Boolean; specifies bold character display read/write
theFormat.bold

Description

The Boolean bold property specifies whether characters are displayed in a bold typeface (true) or a regular (nonbold) typeface (false).

To set bolding for an entire text field, invoke TextField.setTextFormat( ) without specifying any index arguments:

this.createTextField("theField_txt", 1, 0, 0, 200, 20); theField_txt.border = true; theField_txt.text = "Press any key." // Create a TextFormat object format = new TextFormat(); format.bold = true; // Bold the whole field theField_txt.setTextFormat(format);

To set bolding for a single character, apply the format with a single index argument:

theField_txt.setTextFormat(1, format); // Bold the second character ("r")

To set bolding for a range of characters, apply the format using start and end index arguments:

theField_txt.setTextFormat(6, 9, format);  // Bold the characters at                                            // indexes 6, 7, and 8 ("any")

The default bold value (as contained in the TextFormat object returned by TextField.getTextFormat( )) for a text field that contains text is false. For a text field without any text, the bold value is null. For a completely new TextFormat object, it is also null, indicating that bold will not be set when the format is applied to a text field:

trace(anyUnformattedField_txt.getTextFormat().bold);  // Displays: "false" var format = new TextFormat(); trace(format.bold);                                   // Displays: "null"

See Also

TextFormat.italic



    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