Table of Contents

TextFormat.underline Property Flash 6

Boolean; specifies underlined character display read/write
theFormat.underline

Description

The Boolean underline property specifies whether characters are displayed with a line beneath them (true) or without any underline (false).

To underline 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 = "Please enter your name."
// Create a TextFormat object
format = new TextFormat();
format.underline = true;
// Underline the whole field
theField_txt.setTextFormat(format);

To underline a single character, apply the format with a single index argument:

theField_txt.setTextFormat(0, format); // Underline the first character ("P")

To underline a range of characters, apply the format with start and end index arguments:

theField_txt.setTextFormat(0, 6, format);  // Underline the characters at indexes
                                           // 0, 1, 2, 3, 4, and 5 ("Please")

The default underline value (as contained in the TextFormat object returned by TextField.getTextFormat( )) for an existing text field is false; however, for a completely new TextFormat object, it is null, indicating that underline will not be set when the format is applied to a text field:

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

Unlike most web browsers, Flash does not automatically underline hypertext links, so the underline property must be used to indicate links manually, as shown under TextFormat.url.

See Also

TextField.htmlText, TextFormat.url


Table of Contents