User Guide

About skinning components 87
If you want to change a specific scroll bar 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
var oldName = ScrollBar.prototype.downArrowDownName;
ScrollBar.prototype.downArrowDownName = "MyScrollDownArrowDown";
createClassObject(List, "myList1", 0, {dataProvider: ["AL","AR","AZ",
"CA","HI","ID", "KA","LA","MA"]});
myList1.redraw(true);
ScrollBar.prototype.downArrowDownName = oldName;
Note: Set enough data so that the scroll bars appear, or set the
vScrollPolicy property to true.
7.
Select Control > Test Movie.
You can also set subcomponent skins for all components in a document by setting the skin
property on the subcomponent’s
prototype object in the #initclip section of a skin symbol.
To use #initclip to apply an edited skin to all components in a document:
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 and create a new Flash document. Save it with a unique name, such as
SkinsInitExample.fla.
3.
Select the MyScrollDownArrowDown symbol from the library of the edited theme library
example, drag it to the Stage of SkinsInitExample.fla, and delete it.
This adds the symbol to the library without making it visible on the Stage.
4.
Select MyScrollDownArrowDown in the SkinsInitExample.fla library, and select Linkage from
the Library options menu.
5.
Select the Export for ActionScript check box. Click OK.
Export in First Frame is automatically selected.
6.
Double-click MyScrollDownArrowDown in the library to open it in symbol-editing mode.
7.
Enter the following code on Frame 1 of the MyScrollDownArrowDown symbol:
#initclip 10
import mx.controls.scrollClasses.ScrollBar;
ScrollBar.prototype.downArrowDownName = "MyScrollDownArrowDown";
#endinitclip
8.
Do one of the following to add a List component to the document:
Drag a List component from the Components panel to the Stage. Enter enough label
parameters so that the vertical scroll bar will appear.
Drag a List component from the Components panel to the Stage and delete it. Enter the
following code on Frame 1 of the main Timeline of SkinsInitExample.fla:
createClassObject(mx.controls.List, "myListBox1", 0, {dataProvider:
["AL","AR","AZ", "CA","HI","ID", "KA","LA","MA"]});
Note: Add enough data so that the vertical scroll bar appears, or set
vScrollPolicy to true.