【问题标题】:How to put a simple gradient in de buttons of a buttonbar in Flex 4?如何在 Flex 4 的按钮栏的 de 按钮中放置一个简单的渐变?
【发布时间】:2011-04-25 13:09:12
【问题描述】:

到底如何在按钮栏的按钮中放置一个简单的 CSS 渐变? 我一直在到处寻找,我对蒙皮一点也不感兴趣,让所有脏代码只有一个简单的渐变似乎很奇怪。

这是我的css

.my_ButtonBar{
    buttonStyleName: "buttonBarButton"; 
    firstButtonStyleName: "firstButtonBarButton"; 
    lastButtonStyleName: "lastButtonBarButton";
}

.buttonBarButton 
{
    fillColors: red, red;
}

这是我的 mxml

<s:ButtonBar dataProvider="{viewstack}" width="200" top="0" left="0" styleName="main_ButtonBar">
    <s:layout>
        <s:TileLayout columnWidth="200" rowHeight="50"
                horizontalGap="-1" verticalGap="-1" />
    </s:layout>
</s:ButtonBar>

在 user700284 的响应之后,我基于按钮栏类创建了一个新的皮肤类。

<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" 
        alpha.disabled="0.5">

    <fx:Metadata>
    <![CDATA[ 
       /** 
         * @copy spark.skins.spark.ApplicationSkin#hostComponent
         */
        [HostComponent("spark.components.ButtonBar")]
    ]]>
    </fx:Metadata> 

    <s:states>
        <s:State name="normal" />
        <s:State name="disabled" />
    </s:states>

    <fx:Declarations>
        <fx:Component id="firstButton">
            <s:ButtonBarButton skinClass="spark.skins.spark.ButtonBarFirstButtonSkin" />
        </fx:Component>

        <fx:Component id="middleButton" >
            <s:ButtonBarButton skinClass="spark.skins.spark.ButtonBarMiddleButtonSkin" />
        </fx:Component>

        <fx:Component id="lastButton" >
            <s:ButtonBarButton skinClass="spark.skins.spark.ButtonBarLastButtonSkin" />
        </fx:Component>
    </fx:Declarations>

    <s:DataGroup id="dataGroup" width="100%" height="100%">
        <s:layout>
        <s:TileLayout columnWidth="200" rowHeight="50"
            horizontalGap="-1" verticalGap="-1" />
        </s:layout>
    </s:DataGroup>
</s:Skin>

如果我添加一个矩形填充,它将填充整个按钮栏,而不是单独填充每个按钮。我怎样才能在按钮上放一个简单的渐变??????

【问题讨论】:

    标签: apache-flex coding-style gradient


    【解决方案1】:

    我认为您无法通过 CSS 控制 fillColors,因为 spark Button 不支持 fillColors 样式。请查看以下链接:

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Button.html#commonstyleSummary

    因此,您可能不得不求助于为按钮创建皮肤。 :(

    【讨论】:

    • 有人知道怎么做吗?导致它无法找到解决方案。
    【解决方案2】:

    有一种 Spark 样式“chromeColor”可以修改默认颜色。 FTQuest

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-27
      • 2011-01-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多