User Guide
172 Creating Components
Registering a new style name
If you have created a new style name and it is a color style, add the new name to the
colorStyles object in the StyleManager.as file (First
Run\Classes\mx\styles\StyleManager.as). This example adds the
shapeColor style:
// initialize set of inheriting color styles
static var colorStyles:Object =
{
barColor: true,
trackColor: true,
borderColor: true,
buttonColor: true,
color: true,
dateHeaderColor: true,
dateRollOverColor: true,
disabledColor: true,
fillColor: true,
highlightColor: true,
scrollTrackColor: true,
selectedDateColor: true,
shadowColor: true,
strokeColor: true,
symbolBackgroundColor: true,
symbolBackgroundDisabledColor: true,
symbolBackgroundPressedColor: true,
symbolColor: true,
symbolDisabledColor: true,
themeColor:true,
todayIndicatorColor: true,
shadowCapColor:true,
borderCapColor:true,
focusColor:true,
shapeColor:true
};
Register the new style name to the circle and square skins on Frame 1 of each skin movie clip,
as follows:
mx.skins.ColoredSkinElement.setColorStyle(this, "shapeColor");
The color can be changed with the new style name by setting the style on the instance, as
shown here:
shape.setStyle("shapeColor",0x00ff00);