![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
Flash Player 6.
my_txt
.setTextFormat (textFormat
)my_txt
.setTextFormat (index
,textFormat
)my_txt
.setTextFormat (beginIndex
,endIndex
,textFormat
)
textFormat
A TextFormat object, which contains character and paragraph formatting information.
index
An integer that specifies a character within my_txt
.
beginIndex
An integer.
endIndex
An integer that specifies the first character after the desired text span.
Nothing.
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 setTextFormat()
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 textFormat
to all text in the text field.
Usage 2: Applies the properties of textFormat
to the character at position index
.
Usage 3: Applies the properties of the textFormat
parameter to the span of text from the beginIndex
parameter to the endIndex
parameter.
Notice that any text inserted manually by the user, or replaced by means of TextField.replaceSel()
, does not assume the formatting specified in a call to setTextFormat()
. To set the default formatting for a TextField object, use TextField.setNewTextFormat()
.
This example creates a new TextFormat object called myTextFormat
and sets its bold
property to true
. It then calls setTextFormat()
and applies the new text format to the my_txt
text field.
myTextFormat = new TextFormat(); myTextFormat.bold = true; my_txt.setTextFormat(myTextFormat);
TextField.setNewTextFormat()
, TextFormat class
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |