User Guide
550 Chapter 6: Components Dictionary
Setting styles for all Menu components in a document
The Menu class inherits from the ScrollSelectList class. The default class-level style properties are
defined on the ScrollSelectList class, which is shared by all List-based components. You can set
new default style values on this class directly, and the new settings will be reflected in all affected
components.
_global.styles.ScrollSelectList.setStyle("backgroundColor", 0xFF00AA);
To set a style property on the Menu components only, you can create a new
CSSStyleDeclaration and store it in _global.styles.Menu.
import mx.styles.CSSStyleDeclaration;
if (_global.styles.Menu == undefined) {
_global.styles.Menu = new CSSStyleDeclaration();
}
_global.styles.Menu.setStyle("backgroundColor", 0xFF00AA);
When creating a new class-level style declaration, you will lose all default values provided by the
ScrollSelectList declaration. This includes backgroundColor, which is required for
supporting mouse events. To create a class-level style declaration and preserve defaults, use a
for..in loop to copy the old settings to the new declaration.
var source = _global.styles.ScrollSelectList;
var target = _global.styles.Menu;
for (var style in source) {
target.setStyle(style, source.getStyle(style));
}
For more information about class-level styles see “Setting styles for a component class”
on page 71.
Using skins with the Menu component
The Menu component uses an instance of RectBorder for its border (seesee “RectBorder class”
on page 647).
The Menu component has visual assets for the branch, check mark, radio dot, and separator
graphics. These assets are not dynamically skinnable, but the assets can be copied from the Flash
UI Components 2/Themes/MMDefault/Menu Assets/States folder in both themes and modified
as desired. The linkage identifiers cannot be changed, and all Menu instances must use the same
symbols.
To create movie clip symbols for Menu assets:
1.
Create a new FLA file.
2.
Select File > Import > Open External Library, and select the HaloTheme.fla file.
This file is located in the application-level configuration folder. For the exact location on your
operating system, see “About themes” on page 77.
3.
In the theme’s Library panel, expand the Flash UI Components 2/Themes/MMDefault folder
and drag the Menu Assets folder to the library for your document.
4.
Expand the Menu Assets/States folder in the library of your document.