User Guide

About skinning components 85
11.
Drag an instance of the component to the Stage.
For this example, drag two RadioButton components to the Stage, set one to selected, and use
ActionScript to set both to disabled in order to see the changes.
12.
Add ActionScript code to the document to set the new style property on the component
instances or at the global level.
For this example, set the property at the global level as follows:
_global.style.setStyle("symbolBackgroundDisabledColor", 0xD9D9D9);
13.
Select Control > Test Movie.
Applying new skins to a component
Once you have created a new skin, you must apply it to a component in a document. You can use
the
createClassObject() method to dynamically create the component instances, or you can
manually place the component instances on the Stage. There are two different ways to apply skins
to component instances, depending on how you add the components to a document.
To dynamically create a component and apply a new skin:
1.
Select File > New to create a new Flash document.
2.
Select File > Save and give the file a unique name, such as DynamicSkinning.fla.
3.
Drag any components from the Components panel to the Stage, including the component
whose skin you edited (in this example, RadioButton), and delete them.
This adds the symbols to the document’s library, but doesnt make them visible in
the document.
4.
Drag MyRadioTrueUp and any other symbols you customized from MyTheme.fla to the Stage
of DynamicSkinning.fla, and delete them.
This adds the symbols to the document’s library, but doesnt make them visible in
the document.
5.
Open the Actions panel and enter the following on Frame 1:
import mx.controls.RadioButton;
createClassObject(RadioButton, "myRadio", 0, {trueUpIcon:"MyRadioTrueUp",
label: "My Radio Button"});
6.
Select Control > Test Movie.
To manually add a component to the Stage and apply a new skin:
1.
Select File > New to create a new Flash document.
2.
Select File > Save and give the file a unique name, such as ManualSkinning.fla.
3.
Drag components from the Components panel to the Stage, including the component whose
skin you edited (in this example, RadioButton).
4.
Drag MyRadioTrueUp and any other symbols you customized from MyTheme.fla to the Stage
of ManualSkinning.fla, and delete them.
This adds the symbols to the document’s library, but doesnt make them visible in
the document.