User Guide

Combining skinning and styles to customize a component 119
Creating the new style declaration
Now, you need to create a new style declaration and assign styles to the style declaration. After
you have all the styles you want in the style declaration, you can assign the new style name to
the combo box instance.
To create a new style declaration and give it a name:
1. In the first frame of the main Timeline, add the following line at the beginning of your
ActionScript (as a coding convention, you should place all import statements at the
beginning of your ActionScript):
import mx.styles.CSSStyleDeclaration;
2.
On the next line, name the new style declaration and add it to the global style definitions:
var new_style:Object = new CSSStyleDeclaration();
_global.styles.myStyle = new_style;
After you assign a new style declaration to the _global style sheet, you can attach
individual style settings to the
new_style style declaration. For more information about
creating a style sheet for groups for components, instead of style definitions for a single
instance, see “Setting custom styles for groups of components” on page 87).
3. Attach some style settings to the new_style style declaration. The following style settings
include style definitions available to the ComboBox component (see “Using styles with the
ComboBox component” in the Components Language Reference for more a complete list) as
well as styles from the RectBorder class, since the ComboBox component uses the
RectBorder class:
new_style.setStyle("textAlign", "right");
new_style.setStyle("selectionColor", "white");
new_style.setStyle("useRollOver", false);
// borderStyle from RectBorder class
new_style.setStyle("borderStyle", "none");