User Guide

1208 ActionScript classes
See also
getNewTextFormat (TextField.getNewTextFormat method), getTextFormat
(TextField.getTextFormat method)
, setTextFormat (TextField.setTextFormat
method)
setTextFormat (TextField.setTextFormat method)
public setTextFormat([beginIndex:Number], [endIndex:Number],
textFormat:TextFormat) : Void
Applies the text formatting specified by the textFormat parameter to some or all of the text
in a text field.
textFormat must be a TextFormat object that specifies the text formatting
changes desired. Only the non-null properties of textFormat are applied to the text field. Any
property of
textFormat that is set to null will not be applied. By default, all of the properties
of a newly created TextFormat object are set to
null.
There are two types of formatting information in a TextFormat object: character level, and
paragraph level formatting. Each character in a text field might have its own character
formatting settings, such as font name, font size, bold, and italic.
For paragraphs, the first character of the paragraph is examined for the paragraph formatting
settings for the entire paragraph. Examples of paragraph formatting settings are left margin,
right margin, and indentation.
The
setTextFormat() method changes the text formatting applied to an individual
character, to a range of characters, or to the entire body of text in a text field. These usages are
shown in the following table:
Usage Description
my_textField.setTextFor
mat(textFormat:TextForm
at)
Applies the properties of textFormat to all text in the text field.
my_textField.setTextFor
mat(beginIndex:Number,
textFormat:TextFormat)
Applies the properties of textFormat to the character at the
beginIndex position.
my_textField.setTextFor
mat(beginIndex:Number,
endIndex:Number,
textFormat:TextFormat)
Applies the properties of the textFormat parameter to the span of
text from the
beginIndex position to the endIndex position.