User Guide
170 Creating Components
To register a skin to a style:
1. Create a new ActionScript file and copy the following code into it:
import mx.core.UIComponent;
class Shape extends UIComponent{
static var symbolName:String = "Shape";
static var symbolOwner:Object = Shape;
var className:String = "Shape";
var themeShape:String = "circle_skin"
function Shape(){
}
function init(Void):Void{
super.init();
}
function createChildren():Void{
setSkin(1, themeShape);
super.createChildren();
}
}
2.
Save the file as Shape.as.
3. Create a new Flash document and save it as Shape.fla in the same folder as Shape.as
4. Draw a circle on the Stage, select it, and press F8 to convert it to a movie clip.
Give the circle the name and linkage identifier circle_skin.
5. Open the circle_skin movie clip and place the following ActionScript on Frame 1 to
register the symbol with the style name
themeColor:
mx.skins.ColoredSkinElement.setColorStyle(this, "themeColor");
6. Create a new movie clip for the component.
Name the movie clip and linkage identifier Shape.
7. Create two layers. Place a stop() function in the first frame of the first layer. Place the
symbol
circle_skin in the second frame.
This is the component movie clip. For more information, see “Creating a component
movie clip” on page 138.