User Guide
Label component 443
Label component
A label component is a single line of text. You can specify that a label be formatted with HTML.
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. The autoSize parameter is not supported in
live preview.
When you add the Label component to an application, you can use the Accessibility panel
to make it accessible to screen readers. First, you must add the following line of code to
enable accessibility:
mx.accessibility.LabelAccImpl.enableAccessibility();
You enable accessibility for a component only once, regardless of how many instances you have of
the component. For more information, see Chapter 17, “Creating Accessible Content,” in Using
Flash.
Using 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. If you’re building an application
using components based on version 2 of the Macromedia Component Architecture, 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. See “Using styles with the
Label component” on page 444.
Label parameters
You can set the following authoring parameters for each Label component instance in the
Property inspector or in the Component inspector:
text indicates the text of the label; the default value is Label.
html indicates whether the label is formatted with HTML (true) or not (false). If this
parameter is set to
true, a label cannot be formatted with styles. The default value is false.
autoSize indicates how the label sizes and aligns to fit the text. The default value is none. The
parameter can have any of the following four values:
• none, which specifies that the label doesn’t resize or align to fit the text.
• left, which specifies that the right and bottom sides of the label resize to fit the text. The left
and top sides don’t resize.
• center, which specifies that the bottom side of the label resizes to fit the text. The horizontal
center of the label stays anchored at its original horizontal center position.
• right, which specifies that the left and bottom sides of the label resize to fit the text. The top
and right side don’t resize.
CHAPTER 6
Components Dictionary