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";

Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00002515.html