User Guide

About skinning components 103
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 the Components Language Reference.
To apply a new skin to a subcomponent:
1. Follow the steps in “Creating new component skins” on page 99, 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. Drag the List component in the Components panel to the library.
This adds the component to the Library panel, but doesnt make the component visible in
the document.
5. Drag MyScrollDownArrowDown and any other symbols you edited from MyTheme.fla to
the library of SubcomponentProject.fla.
This adds the symbol to the Library panel, but doesnt 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.