Textfield.gettextformat() - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

TextField.getTextFormat()

Availability
Flash Player 6.
Usage
my_txt.getTextFormat() : Object
my_txt.getTextFormat(index:Number) : Object
my_txt.getTextFormat(beginIndex:Number, endIndex:Number) : Object
Parameters
An integer that specifies a character in a string.
index
beginIndex, endIndex
within
.
my_txt
Returns
An object.
Description
Method; returns a TextFormat object containing a particular kind of information.
Usage 1: 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
Usage 2: Returns a TextFormat object containing a copy of the text field's text format at
Usage 3: Returns a TextFormat object containing formatting information for the span of text
from
beginIndex
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.
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
TextField.getNewTextFormat(), TextField.setNewTextFormat(),
TextField.setTextFormat()
888
Chapter 2: ActionScript Language Reference
Integers that specify the starting and ending locations of a span of text
null.
to
. Only properties that are common to all of the text in the
endIndex
.
index

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash mx

Table of Contents