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

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

font (TextFormat.font property)

public font :
String
A string that specifies the name of the font for text. The default value is
that the property is undefined.
Note: For Flash Lite, this property works for embedded fonts only. This property is not
supported for Arabic, Hebrew, and Thai.
Availability: ActionScript 1.0; Flash Lite 2.0
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 text field object text";
mytext.setTextFormat(myformat);

getTextExtent (TextFormat.getTextExtent method)

public getTextExtent(text:String, [width:Number]) : Object
Returns text measurement information for the text string
. The text string is treated as plain text (not HTML).
my_fmt
The method returns an object with six properties:
, and
textFieldHeight
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
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
The
and
width
height
and
textFieldHeight
required for a text field object to display the entire text string. Text fields have a 2-pixel-wide
gutter around them, so the value of
likewise, the value of
textFieldWidth
measurements provide, respectively, the distance above and below
measurement.
ascent
measurements provide the width and height of the text string. The
textFieldWidth
textFieldHeight
is always equal to the value of
textFieldWidth
text
,
ascent
descent
. All measurements are in pixels.
measurements provide the height and width
is equal the value of
, which indicates
null
in the format specified by
,
,
width
height
+ 4;
height
+ 4.
width
TextFormat
,
701

Advertisement

Table of Contents
loading

Table of Contents