User Guide

88 Chapter 5: Customizing Components
The following example explains how to skin something that’s already on the Stage. This example
skins only List scroll bars; any TextArea or ScrollPane scroll bars would not be skinned.
To use #initclip to apply an edited skin to specific components in a document:
1.
Follow the steps in “Editing component skins in a document” on page 81, but edit a scroll bar
skin. For this example, edit the ScrollDownArrowDown skin and give it the new name
MyScrollDownArrowDown.
2.
Select File > New and create a Flash document.
3.
Select File > Save and give the file a unique name, such as MyVScrollTest.fla.
4.
Drag MyScrollDownArrowDown from the theme library to the MyVScrollTest.fla library.
5.
Select Insert > New Symbol and give the symbol a unique name, such as MyVScrollBar.
6.
Select the Export for ActionScript check box. Click OK.
Export in First Frame is automatically selected.
7.
Enter the following code on Frame 1 of the MyVScrollBar symbol:
#initclip 10
import MyVScrollBar
Object.registerClass("VScrollBar", MyVScrollBar);
#endinitclip
8.
Drag a List component from the Components panel to the Stage.
9.
In the Property inspector, enter as many Label parameters as necessary for the vertical scroll bar
to appear.
10.
Select File > Save.
11.
Select File > New and create a new ActionScript file.
12.
Enter the following code:
import mx.controls.VScrollBar
import mx.controls.List
class MyVScrollBar extends VScrollBar{
function init():Void{
if (_parent instanceof List){
downArrowDownName = "MyScrollDownArrowDown";
}
super.init();
}
}
13.
Select File > Save and save this file as MyVScrollBar.as.
14.
Click a blank area on the Stage and, in the Property inspector, click the Publish Settings button.
15.
Click the ActionScript Version Settings button.
16.
Click the Add New Path (+) button to add a new classpath, and select the Target button to
browse to the location of the MyVScrollBar.as file on your hard disk.
17.
Select Control > Test Movie.