User Guide
1234 ActionScript classes
my_txt.wordWrap = true;
my_txt.border = true;
my_txt.text = "this is my first test field object text";
my_txt.setTextFormat(my_fmt);
font (TextFormat.font property)
public font : String
The name of the font for text in this text format, as a string. The default value is null, which
indicates that the property is undefined.
Availability: ActionScript 1.0; Flash Player 6
Example
The following example creates a text field and sets the font to Courier.
this.createTextField("mytext",1,100,100,100,100);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = true;
var myformat:TextFormat = new TextFormat();
myformat.font = "Courier";
mytext.text = "this is my first test field object text";
mytext.setTextFormat(myformat);
getTextExtent (TextFormat.getTextExtent method)
public getTextExtent(text:String, [width:Number]) : Object
Deprecated since Flash Player 8. There is no replacement.
Returns text measurement information for the text string
text in the format specified by
my_fmt. The text string is treated as plain text (not HTML).
The method returns an object with six properties: ascent, descent, width, height,
textFieldHeight, and textFieldWidth. All measurements are in pixels.
If a
width parameter is specified, word wrapping is applied to the specified text. This lets you
determine the height at which a text box shows all of the specified text.
The
ascent and descent measurements provide, respectively, the distance above and below
the baseline for a line of text. The baseline for the first line of text is positioned at the text
field's origin plus its
ascent measurement.