Creating 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 is beside a combo box with dates in a shopping
cart application.
To create an application with the Label component:
1.
Drag a Label component from the Components panel to the Stage.
2.
In the Component inspector, enter Expiration Date for the label parameter.
To create a Label component instance using ActionScript:
1.
Drag the Label component from the Components panel to the current document's library.
This adds the component to the library, but doesn't make it visible in the application.
2.
Select the first frame in the main Timeline, open the Actions panel, and enter the
following code:
this.createClassObject(mx.controls.Label, "my_label", 1);
my_label.text = "Hello World";
This script uses the method
Label instance.
3.
Select Control > Test Movie.
Customizing the Label component
You can transform a Label component horizontally and vertically while authoring and at
runtime. While authoring, select the component on the Stage and use the Free Transform tool
or any of the Modify > Transform commands. You can also set the autoSize authoring
parameter; setting this parameter doesn't change the bounding box in the live preview, but the
label is resized. For more information, see
the
method (see
setSize()
Using styles with the Label component
You can set style properties to change the appearance of a label instance. All text in a Label
component instance must share the same style. For example, you can't set the
for one word in a label and to
"blue"
If the name of a style property ends in "Color", it is a color style property and behaves
differently than noncolor style properties. For more information about styles, see "Using styles
to customize component color and text" in Using Components.
UIObject.createClassObject()
"Label parameters" on page
UIObject.setSize()
for the second word in the same label.
"red"
to create the
752. At runtime, use
) or
Label.autoSize
Customizing the Label component
).
style to
color
753
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers