How do you set the default value of skinClass for a custom component in Flex? I've extended the DropDownList with my custom component, but I would like to specify a default skin to go with it instead of always setting the skinClass value for each instance.
Asked
Active
Viewed 9,404 times
1 Answers
41
You can use css to apply a skin to a component class like so:
@namespace component "com.domain.project.view.component.*";
component|CustomComponent {
skin-class: ClassReference("com.domain.project.view.skin.CustomSkin");
}
Or if you want it within your component code, you can set the style in the constructor:
public function CustomComponent()
{
super();
setStyle("skinClass", CustomSkin);
}

dchang
- 2,007
- 14
- 14
-
This would work, but I'm more looking for how to set it in the ActionScript code so that the skin become part of the component (e.g. like DropDownListSkin is for DropDownList). – Anthony -GISCOE- Aug 18 '10 at 14:34
-
Excellent! You have no idea how much seeing this can actually be done is making me start to warm up to Flex 4. Initial knee-jerk reaction was not good at all. – Adam Nofsinger Nov 05 '10 at 17:17
-
fyi - All the default skins are set in defaults.css in the SDK folders. this is how they get different look & feel/behaviors for spark, wireframe, mobile, etc. – Bron Davies Dec 14 '12 at 17:14