For most components, you'll need to create only one skin. However, there might be cases where you want to create more than one skin for a given component. For example, you might want to create a neutral-looking skin for most of your buttons but create a more colorful "glow" skin for buttons that need to stand out.
Here's how to do this:
Button_upSkin, Button_overSkin, Button_downSkin, and Button_disabledSkin.Create new skin parts and name them similarly to the default skin parts, incorporating the skin name you chose in Step 1. For example, you might name them glowButton_upSkin, glowButton_overSkin, glowButton_downSkin, and glowButton_disabledSkin.
Create a new rule in the flex_skins.css file that refers to the symbols or bitmap files you created in the previous step. (Notice that the rule has a period before the skin name, unlike the rules for the default skins.)
For Flash or Illustrator, it should look like this:
.glowButton
{
upSkin: Embed(source="flex_skins.swf", symbol="glowButton_upSkin");
overSkin: Embed(source="flex_skins.swf", symbol="glowButton_overSkin");
downSkin: Embed(source="flex_skins.swf", symbol="glowButton_downSkin");
disabledSkin: Embed(source="flex_skins.swf", symbol="glowButton_disabledSkin");
}
For Photoshop or Fireworks, it should look like this:
.glowButton
{
upSkin: Embed(source="images/glowButton_upSkin.png");
overSkin: Embed(source="images/glowButton_overSkin.png");
downSkin: Embed(source="images/glowButton_downSkin.png");
disabledSkin: Embed(source="images/glowButton_disabledSkin.png");
}
scaleGrid attributes as described in "Editing scale-9 grids for bitmaps."To apply this skin to a component in a Flex application, set the styleName property on the component to the name of your new skin (without the leading period). For example, to apply the glowButton skin to a button, you would write the Button tag like this:
<mx:Button styleName="glowButton" label="My Glowing Button"/>
Notice that Flex uses the styleName property for this purpose, unlike HTML, which uses the class property.