在 Flex 4.7 中设置向下图标



我不知道如何设置向下图标。在 Flex 3 中,由于按钮中的样式属性,这非常容易。但是,如何为 Flex 4.7 移动项目中的按钮设置不同的向下图标?

这两种方法都会帮助你。 只需一个接一个地尝试..

通过使用第一种方法:

按钮具有styleName名称属性,并且它具有皮肤属性表示DownIconSkin,通过设置这些属性,您可以为按钮设置向下图标

通过使用第二种方法(按钮皮肤):

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>

'

愿这会帮助你...由于没有任何图标,我没有在其中添加图标。但是标签有效,那么图标肯定会起作用

最新更新