我不知道该怎么设置下一个图标。在Flex 3中,由于按钮中有style属性,所以非常简单。但是,如何为Flex 4.7移动项目中的按钮设置不同的下图标呢?
发布于 2014-03-01 11:16:58
这两种方法都对你有帮助。一个接一个地试试..。
使用第一种方法:
按钮具有styleName名称属性,它有一个skinProperty例如DownIconSkin,通过设置这些属性,您可以为按钮设置downIcon
通过使用第二种方法(按钮皮肤):
test.mxml
`
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
applicationDPI="160">
<fx:Script>
<![CDATA[
protected function btnSignButton_clickHandler(event:MouseEvent):void
{
trace('Hello, I am Clicked');
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Button id="btnSignButton"
label="Sign In"
verticalCenter="0"
horizontalCenter="0"
skinClass="DownIconSkin"
click="btnSignButton_clickHandler(event)"/></s:Application>`
DownIconSkin.mxml
`
<?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("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>
<!-- SkinParts
name=iconDisplay, type=spark.primitives.BitmapImage, required=false
name=labelDisplay, type=spark.core.IDisplayText, required=false
-->
<s:Label text="DownState"
includeIn="down"/>
<s:Label text="upState"
includeIn="up"/></s:Skin>`
希望这能帮你..。我没有添加图标,因为它没有任何图标。但是标签有效,那么图标就一定会工作。
https://stackoverflow.com/questions/22098927
复制相似问题