About assigning skins
A user interface (UI) component is composed entirely of attached movie clips. This means that all
assets for a UI component can be external to the UI component movie clip, so they can be used
by other components. For example, if your component needs check box functionality, you can
reuse the existing CheckBox component assets.
The CheckBox component uses a separate movie clip to represent each of its states (FalseUp,
FalseDown, Disabled, Selected, and so on). However, you can associate custom movie clips—
called skins—with these states. At runtime, the old and new movie clips are exported in the SWF
file. The old states simply become invisible to give way to the new movie clips. The ability to
change skins during authoring and at runtime is called skinning.
To skin components, create a variable for every skin element (movie clip symbol) used in the
component and set it to the symbol's linkage ID. This lets a developer set a different skin element
just by changing a parameter in the component, as shown here:
var falseUpIcon = "mySkin";
The following example shows the skin variables for the various states of the CheckBox
component:
var falseUpSkin:String
var falseDownSkin:String
var falseOverSkin:String = ""
var falseDisabledSkin:String = "";
var trueUpSkin:String = "";
var trueDownSkin:String = "";
var trueOverSkin:String = "";
var trueDisabledSkin:String = "";
var falseUpIcon:String = "CheckFalseUp";
var falseDownIcon:String = "CheckFalseDown";
var falseOverIcon:String = "CheckFalseOver";
var falseDisabledIcon:String = "CheckFalseDisabled";
var trueUpIcon:String = "CheckTrueUp";
var trueDownIcon:String = "CheckTrueDown";
var trueOverIcon:String = "CheckTrueOver";
var trueDisabledIcon:String = "CheckTrueDisabled";
About styles
You can use styles to register all the graphics in your component with a class and let that class
control the color scheme of the graphics at runtime. No special code is necessary in the
component implementations to support styles. Styles are implemented entirely in the base classes
(UIObject and UIComponent) and skins.
To add a new style to a component, call
style has been set on an instance, on a custom style sheet, or on the global style sheet, the value is
retrieved. If not, you may need to install a default value for the style on the global style sheet.
For more information about styles, see
on page
67.
950
Chapter 7: Creating Components
= "";
= "";
getStyle("styleName")
"Using styles to customize component color and text"
in the component class. If the
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?