Font (Textformat.font Property); Gettextextent (Textformat.gettextextent Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

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
, which
null
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
in the format specified by
text
. The text string is treated as plain text (not HTML).
my_fmt
The method returns an object with six properties:
,
,
,
,
ascent
descent
width
height
, and
. All measurements are in pixels.
textFieldHeight
textFieldWidth
If a
parameter is specified, word wrapping is applied to the specified text. This lets you
width
determine the height at which a text box shows all of the specified text.
The
and
measurements provide, respectively, the distance above and below
ascent
descent
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
measurement.
ascent
1234
ActionScript classes

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents