User Guide

TextField 659
getNewTextFormat (TextField.getNewTextFormat
method)
public getNewTextFormat() : TextFormat
Returns a TextFormat object containing a copy of the text field's text format object. The text
format object is the format that newly inserted text, such as text entered by a user, receives.
When
getNewTextFormat() is invoked, the TextFormat object returned has all of its
properties defined. No property is
null.
Availability: ActionScript 1.0; Flash Lite 2.0
Returns
TextFormat - A TextFormat object.
Example
The following example displays the specified text field's (my_txt) text format object.
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 160,
120);
var my_fmt:TextFormat = my_txt.getNewTextFormat();
trace("TextFormat has the following properties:");
for (var prop in my_fmt) {
trace(prop+": "+my_fmt[prop]);
}
getTextFormat (TextField.getTextFormat method)
public getTextFormat([beginIndex:Number], [endIndex:Number]) : TextFormat
Returns a TextFormat object for a character, for a range of characters, or for an entire
Tex tFi el d o bj e ct.
Usage 1:my_textField.getTextFormat()
Returns a TextFormat object containing formatting information for all text in a text field.
Only properties that are common to all text in the text field are set in the resulting
TextFormat object. Any property which is mixed, meaning that it has different values at
different points in the text, has a value of
null.
Usage 2:my_textField.getTextFormat(beginIndex:Number)
Returns a TextFormat object containing a copy of the text field's text format at the
beginIndex position.