简体   繁体   English

是否可以像旧的Halo Button一样设置Spark Button? (仅适用于CSS)

[英]Is it possible to style a Spark Button like an old Halo Button? (with CSS only)

I think Adobe are messing with me, from all the docs and tutorials it seems like styling a simple button got much more difficult in Flex 4 (Spark). 我认为Adobe在困扰我,从所有文档和教程中看来,在Flex 4(Spark)中设计简单按钮的样式似乎变得更加困难。 I used to be able to have my designer create the CSS as it wasn't too far off from web standard CSS. 我曾经能够让我的设计师创建CSS,因为它离Web标准CSS不太远。 Now it seems like I need to make a skin first as outlined in this post ? 现在看来我需要像这篇文章中概述的那样先做皮肤吗?

Below is the old button style. 下面是旧的按钮样式。

Button {
    fontFamily: "Arial, Helvetica";
    fontWeight: bold;
    fontSize: 11px;
    paddingTop: 0px;
    paddingBottom: 0px;
    highlightAlphas: 0.42, 0.13;
    fillAlphas: 1, 1, 1, 1;
    fillColors: #B9DEF8, #9AC3EB, #B9DEF8, #9AC3EB;
    color: #477199;
    textRollOverColor: #477199;
    textSelectedColor: #3399cc;
    borderStyle: none;  
}

thanks! 谢谢!

Skinning the Spark Button would be a programmatic approach to which you could mimic the Halo mx:button very closely. 设置“ Spark Button”的外观将是一种编程方法,您可以非常接近地模仿Halo mx:button。

If you just wanted your application to use the Halo theme, you could use Halo theme. 如果您只是希望您的应用程序使用Halo主题,则可以使用Halo主题。

It's also important to note mx:Button included things like icon, which Spark Button does not. 同样重要的是要注意mx:Button包括图标之类的东西,而Spark Button没有。

As you denote you want to use CSS only, you'll have to dive in to mx skin class at: 如您所愿,您只想使用CSS,则必须在以下位置深入研究mx skin类:

mx.skins.halo.ButtonSkin

Spark theme: Spark主题:

火花主题

Halo theme: 光环主题:

光环主题

Based upon your CSS for spark: 根据您的CSS来获取火花:

<?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"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               minWidth="955"
               minHeight="600">

    <fx:Style>
        @namespace s "library://ns.adobe.com/flex/spark";
        @namespace mx "library://ns.adobe.com/flex/mx";

        s|Button
        {
            fontFamily: "Arial, Helvetica";
            fontWeight: bold;
            fontSize: 11px;
            paddingTop: 0px;
            paddingBottom: 0px;
            highlightAlphas: 0.42, 0.13;
            fillAlphas: 1, 1, 1, 1;
            fillColors: #B9DEF8, #9AC3EB, #B9DEF8, #9AC3EB;
            color: #477199;
            textRollOverColor: #477199;
            textSelectedColor: #3399cc;
            borderStyle: none;  
        }
    </fx:Style>

    <s:VGroup width="100%"
              height="100%"
              paddingTop="10"
              paddingLeft="10">

        <s:Button label="Hello, world!" />

        <mx:Button label="Hello, world!" />

    </s:VGroup>

</s:Application>

Yes, it is possible. 对的,这是可能的。

Check out the styles on the Spark Button to find out what can be modified using CSS. 在“火花按钮”上查看样式,以了解可以使用CSS修改的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM