The TextLineMetrics class contains information about the text position and measurements of a
line of text within a text field. All measurements are in pixels. Objects of this class are returned by the
flash.text.TextField.getLineMetrics() method.

For measurements related to the text field containing the line of text (for example, the "Text Field height" measurement in the diagram), see flash.text.TextField.

The following diagram indicates the points and measurements of a text field and the line of text the field contains:

height

The height value of the text of the selected lines (not necessarily the complete text) in pixels. The height of the
text line does not include the gutter height. See the "Line height" measurement in the overview diagram
for this class.

width

The width value is the width of the text of the selected lines (not necessarily the complete text) in pixels. The width of the
text line is not the same as the width of the text field. The width of the text line is relative to the
text field width, minus the gutter width of 4 pixels (2 pixels on each side). See the "Text Line width"
measurement in the overview diagram for this class.

x

The x value is the left position of the first character in pixels. This value includes the margin,
indent (if any), and gutter widths. See the "Text Line x-position" in the overview diagram for this class.

Creates a TextLineMetrics object. The TextLineMetrics object contains information about
the text metrics of a line of text in a text field. Objects of this class are returned by the
flash.text.TextField.getLineMetrics() method.

See the diagram in the overview for this class for the properties in context.

Assigns the result of a call to getLabelText() to the text property
of label. The getLabelText() method creates a variable of type XML and assigns
it to an XML node named body, which is populated with a long sentence.

Adds label to the display list using addChild().

A method that listens for resize events performed on the stage is then added called
resizeHandler(). Every time the Flash Player window size is changed, a RESIZE
event is dispatched and the following happens:

draw() is called to ensure that label appears in the center of the
stage and surrounded by a 10-pixel buffer.

setTimeout() then executes showMetrics() after a short delay. The
delay is added because the line metrics are not updated until after the RESIZE event has
completed and the stage has fully re-drawn.

showMetrics() assigns a TextLineMetrics variable named metrics to
the result of a call to getLineMetrics() and this variable is then passed to
a new instance of a LineMetricsReader instance named reader. The two
variables are then used within calls to trace() to print out the first (and only)
line of label and information provided by the LineMetricsReader instance through its
toString() method.

The constructor forces a single dispatch of the resize event to force
label to be drawn correctly when the SWF file is first loaded.