I’m trying to skin a button with images.
The following code is for flex 3, but I need the equivalent in flex 4 code.
Not using skin class.
.muteVolumeButton
{
upSkin: Embed(source='images/sound-mute.gif');
overSkin:Embed(source='images/sound-hover.gif');
downSkin: Embed(source='images/sound-on.gif');
disabledSkin: Embed(source='images/sound-mute.gif');
}
Please post the flex 4 code.
I should say that skinning in Spark framework is a bit different from Halo way.
The best description is here. And its a best and simplest way to solve your problem.
Here is code:
components.ImageButton.as
Script:
MXML part:
In all other cases you always can skin the states via CSS.
@namespace s "library://ns.adobe.com/flex/spark";s|Button:downHere are some useful links:
http://blog.flexexamples.com/2009/03/03/styling-an-emphasized-fxbutton-control-in-flex-gumbo/
http://blog.flexexamples.com/2010/03/24/using-a-bitmap-image-skin-in-a-spark-button-control-in-flex-4/
http://opensource.adobe.com/wiki/display/flexsdk/CSS+Namespaces+Support
http://cookbooks.adobe.com/post_How_to_use_the_new_CSS_syntax_in_Flex_4-15726.html