过滤器是否会破坏Flex 4.5皮肤中的colorizeExclusions,如果有,是否有解决方法?

时间:2011-07-16 00:01:58

标签: flex filter skinning flex-spark dropshadow

我在Flex 4.5中创建了一个MXML spark按钮皮肤,看起来非常有效,除了在向下状态下,它忽略了我的 colorizeExclusions 数组(目前正在保护文本标签和突出显示按钮)。 up-state和down-state之间的唯一区别在于我在向下状态下应用内部阴影。

StackOverflow不会让我发布图片,因为我是新用户,所以我在其他地方发布了一些:

Up State

up state

Down State

down state

在第二张图片中查看高光和文字如何用蓝色着色?那只是简单的错误

如果我对这个内部阴影没有任何状态限制,我会看到同样的问题:我的colorizeExclusions被忽略,因此它似乎与状态或任何特定于状态的CSS(没有任何关系)有任何关系在任何情况下,无论如何都是。)

这是按钮皮肤代码:

<?xml version="1.0" encoding="utf-8"?>
<s:SparkButtonSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:fb="http://ns.adobe.com/flashbuilder/2009"
               xmlns:fxg="assets.fxg.*"
               minWidth="18" minHeight="18"
               alpha.disabled="0.5">

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

<fx:Script fb:purpose="styling">
    <![CDATA[         
        import spark.components.Group;
        /* Define the skin elements that should not be colorized. 
        For button, the graphics are colorized but the label is not. */
        static private const exclusions:Array = ["labelDisplay", "highlight"];

        /** 
         * @private
         */     
        override public function get colorizeExclusions():Array {return exclusions;}

        /**
         * @private
         */
        override protected function initializationComplete():void
        {
            useChromeColor = true;
            super.initializationComplete();
        }  


    ]]>        
</fx:Script>

<!-- states -->
<s:states>
    <s:State name="up" />
    <s:State name="over" />
    <s:State name="down" />
    <s:State name="disabled" />
</s:states>

<s:Group left="0" right="0" top="0" bottom="0">
    <!-- Background --> 
    <s:Group id="background" left="0" right="0" top="0" bottom="0">
        <fxg:GlassButtonBack excludeFrom="over" left="0" right="0" top="0" bottom="0"/>
        <fxg:GlassButtonBackBright includeIn="over" left="0" right="0" top="0" bottom="0"/>
    </s:Group>


    <!-- layer 8: text -->
    <!--- @copy spark.components.supportClasses.ButtonBase#labelDisplay  -->

    <s:Label id="labelDisplay" left="16" right="16" top="8" bottom="8"
             fontWeight="bold" horizontalCenter="0" maxDisplayedLines="1" textAlign="center"
             verticalAlign="middle" verticalCenter="1"/>

    <s:Rect id="highlight" left="3" right="3" top="3" height="40%" radiusX="6" radiusY="6">
        <s:fill>
            <s:LinearGradient rotation="90">
                <s:entries>
                    <s:GradientEntry ratio="0" alpha="0.9" color="#FFFFFF" />
                    <s:GradientEntry ratio="1" alpha="0" color="#FFFFFF" />
                </s:entries>
            </s:LinearGradient>
        </s:fill>
    </s:Rect>
    <s:filters>
        <s:DropShadowFilter includeIn="down" inner="true" color="#000000" blurX="10" blurY="10" angle="90"/>

    </s:filters>

</s:Group>

有谁知道这里究竟发生了什么?这是一个Flex bug吗?有解决方法吗?我做了些蠢事吗?我真的很茫然,在这里。

1 个答案:

答案 0 :(得分:0)

快速概述:

static private const exclusions:Array = ["labelDisplay", "highlight"];

我认为这不应该是静态的,请尝试删除它,看看会发生什么。