Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > UIObject class > UIObject.setSkin() | |||
Flash Player 6 (6.0.79.0).
Flash MX 2004.
componentInstance.setSkin(id,linkageName)
id A number indicating the depth of the skin within the component.
linkageName A string indicating an asset in the library.
A reference to the movie clip (skin) that was attached.
Method; sets a skin in the component instance. Use this method in a component's class file when you are creating a component. For more information, see About assigning skins in Using ActionScript 2.0 Components.
You cannot use this method to set a component's skins at runtime (for example, the way you set a component's styles at runtime).
This example is a code snippet from the class file of a new component, called Shape. It creates a variable, themeShape and sets it to the Linkage identifier of the skin. In the createChildren() method, the setSkin() method is called and passed the id 1 and the variable that holds the linkage identifier of the skin:
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();
}
}
Flash CS3