TextField.setTextFormat()
Availability
Flash Player 6.
Usage
my_txt.setTextFormat (textFormat)
my_txt.setTextFormat (index, textFormat)
my_txt.setTextFormat (beginIndex, endIndex, textFormat)
Parameters
A TextFormat object, which contains character and paragraph formatting
textFormat
information.
An integer that specifies a character within
index
An integer.
beginIndex
An integer that specifies the first character after the desired text span.
endIndex
Returns
Nothing.
Description
Method; sets a TextFormat object for a specified range of text in a text field. You can assign each
character in a text field a text format. The text format of the first character of a paragraph is
examined to perform paragraph formatting for the entire paragraph. The
method changes the text format applied to individual characters, to groups of characters, or to the
entire body of text in a text field.
The text format is set in a new TextFormat object. It contains both character and paragraph
formatting information. Character formatting information describes the appearance of individual
characters, for example, font name, point size, color, and associated URL. Paragraph formatting
information describes the appearance of a paragraph, for example, left margin, right margin,
indentation of the first line, and left, right, and center alignment.
Usage 1: Applies the properties of
Usage 2: Applies the properties of
Usage 3: Applies the properties of the
parameter to the
beginIndex
Notice that any text inserted manually by the user, or replaced by means of
TextField.replaceSel()
setTextFormat()
TextField.setNewTextFormat()
Example
This example creates a new TextFormat object called
. It then calls
true
myTextFormat = new TextFormat();
myTextFormat.bold = true;
my_txt.setTextFormat(myTextFormat);
702
Chapter 12: ActionScript Dictionary
textFormat
textFormat
textFormat
endIndex
, does not assume the formatting specified in a call to
. To set the default formatting for a TextField object, use
.
and applies the new text format to the
setTextFormat()
.
my_txt
to all text in the text field.
to the character at position
parameter to the span of text from the
parameter.
myTextFormat
setTextFormat()
.
index
and sets its
property to
bold
text field.
my_txt
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?