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 TextField object.

Availability: ActionScript 1.0; Flash Lite 2.0

Parameters

beginIndex:Number [optional] - An integer that specifies a character in a string. If you do not specify beginIndex and endIndex, the TextFormat object returned is for the entire TextField.

endIndex:Number [optional] - An integer that specifies the end position of a span of text. If you specify beginIndex but do not specify endIndex, the TextFormat returned is for the single character specified by beginIndex.

Returns

TextFormat - An object.

Example

The following ActionScript traces all of the formatting information for a text field that is created at runtime.

this.createTextField("dyn_txt", this.getNextHighestDepth(), 0, 0, 100, 200);
dyn_txt.text = "Frank";
dyn_txt.setTextFormat(new TextFormat());
var my_fmt:TextFormat = dyn_txt.getTextFormat();
for (var prop in my_fmt) {
    trace(prop+": "+my_fmt[prop]);
}

See also

getNewTextFormat (TextField.getNewTextFormat method), setNewTextFormat (TextField.setNewTextFormat method), setTextFormat (TextField.setTextFormat method)