Changing skin properties in the prototype
If a component does not directly support skin variables, you can subclass the component and replace its skins. For example, the ComboBox component doesn't directly support skinning its drop-down list because the ComboBox uses a List component as its drop-down list.
If a component is composed of subcomponents, the subcomponents are identified in the component's entry in Components Dictionary.
- Follow the steps in Editing component skins, but edit a scroll bar skin. For this example, edit the ScrollDownArrowDown skin and give it the new name MyScrollDownArrowDown.
- Select File > New and create a Flash document.
- Select File > Save and give the file a unique name, such as MyComboTest.fla.
- Drag MyScrollDownArrowDown from the theme library above to the Stage of MyComboTest.fla and delete it.
This adds the symbol to the library, but doesn't make it visible on the Stage.
- Select Insert > New Symbol and give it a unique name, such as MyComboBox.
- Select the Export for ActionScript checkbox and click OK.
Export in First Frame is automatically selected.
- Enter the following code in the Actions panel on Frame 1 actions of MyComboBox:
#initclip 10
import MyComboBox
Object.registerClass("ComboBox", MyComboBox);
#endinitclip
- Drag a ComboBox component to the Stage.
- In the Property inspector, enter as many Label parameters as it takes for the vertical scroll bar to appear.
- Select File > Save.
- Select File > New and create a new ActionScript file (Flash Professional only).
- Enter the following code:
import mx.controls.ComboBox
import mx.controls.scrollClasses.ScrollBar
class MyComboBox extends ComboBox{
function getDropdown():Object{
var oldName = ScrollBar.prototype.downArrowDownName;
ScrollBar.prototype.downArrowDownName = "MyScrollDownArrowDown";
var r = super.getDropdown();
ScrollBar.prototype.downArrowDownName = oldName;
return r;
}
}
- Select File > Save and save this file as MyComboBox.as.
- Click a blank area on the Stage and, in the Property inspector, select the Publish Settings button.
- Select the ActionScript version Settings button.
- Click the Plus button to add a new classpath, and select the Target button to browse to the location of the MyComboBox.as file on your hard drive.
- Select Control > Test Movie.