我的按钮上面有皮肤:
<?xml version="1.0" encoding="utf-8"?><s:SparkSkin
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
>
<!-- host component -->
<fx:Metadata>
<![CDATA[
[HostComponent("spark.components.Button")]
]]>
</fx:Metadata>
<!-- states -->
<s:states>
<s:State name="up" />
<s:State name="over" stateGroups="overStates"/>
<s:State name="down" stateGroups="overStates" />
<s:State name="disabled" />
</s:states>
.....
</s:SparkSkin>
我想知道如何为具有相同皮肤的不同按钮添加不同的图像。
答案 0 :(得分:1)
两个步骤:
icon
样式 <s:Button icon="@Embed('/path/to/my-icon.png')"
skinClass="path.to.MyButtonSkin" />
答案 1 :(得分:0)
您可以设置图像的路径(完整路径或相对于您所在的路径)
<s:Button label="Spark Button with dynamic icon" icon="assets/asterisk_orange.png" />
或嵌入图片
<s:Button label="Spark Button with inline embedded icon" icon="@Embed('assets/asterisk_orange.png')" />