Use the Label component

The Label component
displays a single line of text, typically to identify some other
element or activity on a web page. You can specify that a label
be formatted with HTML to take advantage of its text formatting
tags. You can also control the alignment and size of a label. Label
components don’t have borders, cannot be focused, and don’t broadcast
any events.

A live preview of each Label instance reflects changes made to
parameters in the Property inspector or Component inspector during
authoring. The label doesn’t have a border, so the only way to see
its live preview is to set its text parameter.

User interaction with the Label component

Use
a Label component to create a text label for another component in
a form, such as a “Name:” label to the left of a TextInput field
that accepts a user’s name. It’s a good idea to use a Label component
instead of a plain text field because you can use styles to maintain
a consistent look and feel.

If you want to rotate a Label component, you must embed the fonts;
otherwise they won’t show when you test the movie.

Label component parameters

You can set the following authoring
parameters in the Property inspector or in the Component inspector
for each Label component
instance:
autoSize
,
condenseWhite
,
selectable
,
text
, and
wordWrap
. Each of these parameters has a corresponding ActionScript
property of the same name. For information on the possible values
for these parameters, see the Label class in the
ActionScript 3.0 Language and Components Reference
.

Create an application with the Label component

The
following procedure explains how to add a Label component to an
application while authoring. In this example, the label simply displays
the text “Expiration Date.”

Create a new Flash (ActionScript 3.0) document.

Drag a Label component from the Components panel to the Stage
and give it the following values in the Property inspector:

Enter
aLabel
for the instance name.

Enter
80
for the W value.

Enter
100
for the X value.

Enter
100
for the Y value.

Enter
Expiration Date
for the
text
parameter.

Drag a TextArea component to the Stage and give it the following
values in the Property inspector:

Enter
aTa
for the instance name.

Enter
22
for the H value.

Enter
200
for the X value.

Enter
100
for the Y value.

Open the Actions panel, select Frame 1 in the main Timeline,
and enter the following ActionScript code:

Create a Label component instance using ActionScript

The following
example creates a Label parameter using ActionScript. It uses a Label
to identify the function of a ColorPicker component and it uses
the
htmlText
property to apply formatting to the Label’s text.

Create a new Flash (ActionScript 3.0) document.

Drag the Label component from the Components panel to the
current document’s Library panel.

Drag the ColorPicker component from the Components panel
to the current document’s Library panel.

Open the Actions panel, select Frame 1 in the main Timeline,
and enter the following ActionScript code: