03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

See also<br />

getNewTextFormat (TextField.getNewTextFormat method), getTextFormat<br />

(TextField.getTextFormat method), setTextFormat (TextField.setTextFormat<br />

method)<br />

setTextFormat (TextField.setTextFormat method)<br />

public setTextFormat([beginIndex:Number], [endIndex:Number],<br />

textFormat:TextFormat) : Void<br />

Applies the text formatting specified by the textFormat parameter to some or all of the text<br />

in a text field. textFormat must be a TextFormat object that specifies the text formatting<br />

changes desired. Only the non-null properties of textFormat are applied to the text field. Any<br />

property of textFormat that is set to null will not be applied. By default, all of the properties<br />

of a newly created TextFormat object are set to null.<br />

Note: This method will not work if a style sheet is applied to the text field.<br />

There are two types of formatting information in a TextFormat object: character level, <strong>and</strong><br />

paragraph level formatting. Each character in a text field might have its own character<br />

formatting settings, such as font name, font size, bold, <strong>and</strong> italic.<br />

For paragraphs, the first character of the paragraph is examined for the paragraph formatting<br />

settings for the entire paragraph. Examples of paragraph formatting settings are left margin,<br />

right margin, <strong>and</strong> indentation.<br />

The setTextFormat() method changes the text formatting applied to an individual<br />

character, to a range of characters, or to the entire body of text in a text field. These usages are<br />

shown in the following table:<br />

Usage Description<br />

my_textField.setTextFo<br />

rmat(textFormat:TextFo<br />

rmat)<br />

my_textField.setTextFo<br />

rmat(beginIndex:Number<br />

,<br />

textFormat:TextFormat)<br />

my_textField.setTextFo<br />

rmat(beginIndex:Number<br />

, endIndex:Number,<br />

textFormat:TextFormat)<br />

1228 <strong>ActionScript</strong> classes<br />

Applies the properties of<br />

textFormat to all text in the<br />

text field.<br />

Applies the properties of<br />

textFormat to the character<br />

at the beginIndex position.<br />

Applies the properties of<br />

the textFormat parameter<br />

to the span of text from the<br />

beginIndex position to the<br />

endIndex position.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!