User Guide
444 Chapter 6: Components Dictionary
Note: The Label component’s autoSize property is different from the built-in ActionScript TextField
object’s
autoSize property.
You can write ActionScript to set additional options for Label instances using its methods,
properties, and events. For more information, see “Label class” on page 445.
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.
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 does resize. For more
information, see “Label parameters” on page 443. At runtime, use the
setSize() method (see
UIObject.setSize()) or Label.autoSize.
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
color style to
"blue" for one word in a label and to "red" for the second word in the same label.
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” on page 67.
A Label component supports the following styles:
Style Theme Description
color
Both The text color. The default value is 0x0B333C for the Halo
theme and blank for the Sample theme.
disabledColor
Both The color for text when the component is disabled. The default
color is 0x848384 (dark gray).
embedFonts
Both A Boolean value that indicates whether the font specified in
fontFamily is an embedded font. This style must be set to
true if fontFamily refers to an embedded font. Otherwise, the
embedded font will not be used. If this style is set to
true and
fontFamily does not refer to an embedded font, no text will be
displayed. The default value is
false.
fontFamily
Both The font name for text. The default value is "_sans".