Flash Lite 2 |
|||
| Flash Lite 2.x ActionScript Language Reference > ActionScript classes > TextField > getTextFormat (TextField.getTextFormat method) | |||
Returns a TextFormat object for a character, for a range of characters, or for an entire TextField object.
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.
my_textField.getTextFormat(beginIndex:Number) Returns a TextFormat object containing a copy of the text field's text format at the beginIndex position.
my_textField.getTextFormat(beginIndex:Number,endIndex:Number) Returns a TextFormat object containing formatting information for the span of text from beginIndex to endIndex. Only properties that are common to all of the text in the specified range is set in the resulting TextFormat object. Any property that is mixed (it has different values at different points in the range) has its value set to null.
Availability: ActionScript 1.0; Flash Lite 2.0
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.
TextFormat - An object.
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]);
}
getNewTextFormat (TextField.getNewTextFormat method), setNewTextFormat (TextField.setNewTextFormat method), setTextFormat (TextField.setTextFormat method)