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:
Follow the steps in
1.
skin. For this example, edit the ScrollDownArrowDown skin and give it the new name
MyScrollDownArrowDown.
Select File > New and create a Flash document.
2.
Select File > Save and give the file a unique name, such as MyVScrollTest.fla.
3.
Drag MyScrollDownArrowDown from the theme library to the MyVScrollTest.fla library.
4.
Select Insert > New Symbol and give the symbol a unique name, such as MyVScrollBar.
5.
Select the Export for ActionScript check box. Click OK.
6.
Export in First Frame is automatically selected.
Enter the following code on Frame 1 of the MyVScrollBar symbol:
7.
#initclip 10
import MyVScrollBar
Object.registerClass("VScrollBar", MyVScrollBar);
#endinitclip
Drag a List component from the Components panel to the Stage.
8.
In the Property inspector, enter as many Label parameters as necessary for the vertical scroll bar
9.
to appear.
Select File > Save.
10.
Select File > New and create a new ActionScript file.
11.
Enter the following code:
12.
import mx.controls.VScrollBar
import mx.controls.List
class MyVScrollBar extends VScrollBar{
function init():Void{
if (_parent instanceof List){
downArrowDownName = "MyScrollDownArrowDown";
}
super.init();
}
}
Select File > Save and save this file as MyVScrollBar.as.
13.
Click a blank area on the Stage and, in the Property inspector, click the Publish Settings button.
14.
Click the ActionScript Version Settings button.
15.
Click the Add New Path (+) button to add a new classpath, and select the Target button to
16.
browse to the location of the MyVScrollBar.as file on your hard disk.
Select Control > Test Movie.
17.
88
Chapter 5: Customizing Components
"Editing component skins in a document" on page
81, but edit a scroll bar
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?
Questions and answers