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.
+6
A:
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);
}
Dave
2010-08-18 14:23:16
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-
2010-08-18 14:34:29
Gotcha, tweaked the answer for doing it in code.
Dave
2010-08-18 14:57:32
Perfect, thanks.
Anthony -GISCOE-
2010-08-18 17:28:49