If you are using spark components buttons , you need to use SkinClass property , in which you can pass any skin object. In this Skin you can set states like up , down , over , disabled.
// code to create a skin class
<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<!-- host component -->
<fx:Metadata>
[HostComponent("ImageButton")]
</fx:Metadata>
<!-- states -->
<s:states>
<s:State name="down" />
<s:State name="over" />
<s:State name="up" />
<s:State name="disabled" />
</s:states>
<!-- SkinParts
name=labelDisplay, type=spark.core.IDisplayText, required=false
name=iconDisplay, type=spark.primitives.BitmapImage, required=false
-->
<s:BitmapImage source="@Embed('add_audio.png')" includeIn="disabled" />
<s:BitmapImage source="@Embed('add_audio.png')" includeIn="up" />
<s:BitmapImage source="@Embed(add_audio_press.png')" includeIn="over"/>
<s:BitmapImage source="@Embed('add_audio_press.png')" includeIn="down"/>
// create a custom button class
package
{
import spark.components.Button;
public class ImageButton extends Button
{
public function ImageButton()
{
super();
this.buttonMode=true;
}
}
}
use these two classes like this.
<local:ImageButton x="2" y="43" skinClass="skins.audio.Cut" />