我试图用我自己的自定义图像更改经典的火花按钮图像。为此,我使用了按钮的 skinsClass 属性。我的问题是当我短时间单击按钮时,我的图像会出现并消失,然后执行按钮的操作。我想实现静态图像点击之类的东西。
这是按钮的代码:
var button:Button = new Button();
button.setStyle('skinClass', skins.ImageButtonSkin);
这是皮肤类的代码:
<?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"
minWidth="48" minHeight="48"
alpha.up="1"
alpha.down="0">
<!-- host component -->
<fx:Metadata>
[HostComponent("spark.components.Button")]
</fx:Metadata>
<!-- states -->
<s:states>
<s:State name="disabled" />
<s:State name="down" />
<s:State name="over" />
<s:State name="up" />
</s:states>
<s:BitmapImage source="../assets/gift-icon.png" includeIn="down"/>
<s:BitmapImage source="../assets/gift-icon.png" includeIn="up"/>
<s:BitmapImage source="../assets/gift-icon.png" includeIn="over"/>
<s:BitmapImage source="../assets/gift-icon.png" includeIn="disabled"/>
<!-- SkinParts
name=iconDisplay, type=spark.primitives.BitmapImage, required=false
name=labelDisplay, type=spark.core.IDisplayText, required=false
-->
</s:Skin>