TextFormat.getTextExtent ()

Availability

Flash Player 6.

Usage

my_fmt.getTextExtent (text, [width])

Parameters

text A string.

width A number that represents the width, in pixels, at which the specified text should wrap.

Returns

An object with the properties width, height, ascent, and descent.

Description

Method; returns metrics of the text string specified in the text parameter in this character format. The return value is an object of class Object with four properties: width, height, ascent, and descent.

If width is specified, word wrapping is applied to the specified text, and the height value returned is the total height of the wrapped text. Thus, you can determine how tall a text box must be to show all of the specified text.

The text string is treated as plain text (not HTML).

Examples