User Guide
86 Chapter 5: Customizing Components
5.
Select the RadioButton component on the Stage and open the Actions panel.
6.
Attach the following code to the RadioButton instance:
onClipEvent(initialize){
trueUpIcon = "MyRadioTrueUp";
}
7.
Select Control > Test Movie.
Applying new skins to a subcomponent
In certain situations you may want to modify the skins of a subcomponent in a component, but
the skin properties are not directly available (for example, there is no direct way to alter the skins
of the scroll bar in a List component). The following code lets you access the scroll bar skins. All
the scroll bars that are created after this code runs will also have the new skins.
If a component is composed of subcomponents, the subcomponents are identified in the
component’s entry in Chapter 6, “Components Dictionary.”
To apply a new skin to a subcomponent:
1.
Follow the steps in “Creating new component skins” on page 83, but edit a scroll bar skin.
For this example, edit the ScrollDownArrowDown skin and give it the new name
MyScrollDownArrowDown.
2.
Select File > New to create a new Flash document.
3.
Select File > Save and give the file a unique name, such as SubcomponentProject.fla.
4.
Double-click the List component in the Components panel to add it to the Stage, and press
Backspace to delete it from the Stage.
This adds the component to the Library panel, but doesn’t make the component visible in
the document.
5.
Drag MyScrollDownArrowDown and any other symbols you edited from MyTheme.fla to the
Stage of SubcomponentProject.fla, and delete them.
This adds the symbol to the Library panel, but doesn’t make it visible in the document.
6.
Do one of the following:
■ If you want to change all scroll bars in a document, enter the following code in the Actions
panel on Frame 1 of the Timeline:
import mx.controls.List;
import mx.controls.scrollClasses.ScrollBar;
ScrollBar.prototype.downArrowDownName = "MyScrollDownArrowDown";
You can then enter the following code on Frame 1 to create a list dynamically:
createClassObject(List, "myListBox", 0, {dataProvider: ["AL","AR","AZ",
"CA","HI","ID", "KA","LA","MA"]});
Or, you can drag a List component from the library to the Stage.