Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex Flex 4按钮蒙皮禁用alpha设置被忽略?_Apache Flex_Skinning_Flex Spark - Fatal编程技术网

Apache flex Flex 4按钮蒙皮禁用alpha设置被忽略?

Apache flex Flex 4按钮蒙皮禁用alpha设置被忽略?,apache-flex,skinning,flex-spark,Apache Flex,Skinning,Flex Spark,我尝试为Spark按钮构建Flex 4皮肤,这是典型的做法。我根据自己的喜好调整了颜色和其他样式,包括使用点选择器指定不同状态下的替代颜色等。但是,当按钮被禁用时,这些都将被忽略。无论我做什么,在禁用状态下,我的按钮总是有错误的颜色,并且alpha'd为0.5(即使我特别声明alpha.disabled=“1”)。所有其他蒙皮状态均按预期工作。这是怎么回事 这是我的定制皮肤。如果它工作正常,它将看起来没有阴影或高光,并且是渐变灰色。相反,它显示为上升状态的50%alpha版本(亮绿色) 错误在于

我尝试为Spark按钮构建Flex 4皮肤,这是典型的做法。我根据自己的喜好调整了颜色和其他样式,包括使用点选择器指定不同状态下的替代颜色等。但是,当按钮被禁用时,这些都将被忽略。无论我做什么,在禁用状态下,我的按钮总是有错误的颜色,并且alpha'd为0.5(即使我特别声明alpha.disabled=“1”)。所有其他蒙皮状态均按预期工作。这是怎么回事

这是我的定制皮肤。如果它工作正常,它将看起来没有阴影或高光,并且是渐变灰色。相反,它显示为上升状态的50%alpha版本(亮绿色)


错误在于_action1Button不是实际的按钮,而是按钮的容器。啊!将其切换到
\u action1Button.actionButton.enabled=false修复了这个问题。

你的皮肤对我来说很好。我在启用状态下得到一个绿色按钮,然后在启用时没有阴影的灰色渐变为false。我这样测试它(TestSkin是上面发布的皮肤):



我想问题与你如何使用皮肤有关。你能把代码贴在按钮定义的地方吗?

Gah!我想会是像这样愚蠢的事情。我正确地设置了skin类,但我(在构建时使用Actionscript)设置了容器的启用设置,而不是按钮本身。我已经在上面的编辑中发布了相关代码。谢谢你的调查!
<?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"
             minWidth="21" minHeight="21" alpha.disabled="1">

    <fx:Metadata>
        <![CDATA[ 
            [HostComponent("spark.components.Button")]
        ]]>
    </fx:Metadata>

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

    <s:Rect id="backgroundAndShadow" left="0" right="0" top="0" bottom="0" radiusX="5" radiusY="5">
        <s:filters>
            <s:DropShadowFilter blurX="5" blurY="5" blurX.down="3" blurY.down="3" alpha="0.5" distance="1" distance.down="0" angle="90" excludeFrom="disabled" />
        </s:filters>
        <s:fill>
            <s:LinearGradient rotation="90">
                <s:GradientEntry color.up="#00AD00" color="#007A00" color.disabled="#cccccc" />
                <s:GradientEntry color.up="#29FF29" color="#00F500" color.disabled="#bbbbbb" />
            </s:LinearGradient>
        </s:fill>
    </s:Rect>

    <s:Rect id="highlight" left="1" right="1" top="1" height="50%" topLeftRadiusX="4" topLeftRadiusY="4" topRightRadiusX="4" topRightRadiusY="4" excludeFrom="disabled">
        <s:fill>
            <s:LinearGradient rotation="90">
                <s:GradientEntry color="#ffffff" alpha="0.8" />
                <s:GradientEntry color="#ffffff" alpha="0.3" />
            </s:LinearGradient>
        </s:fill>
    </s:Rect>

    <s:Label id="labelDisplay"
             textAlign="center"
             horizontalCenter="0" verticalCenter="1" verticalAlign="middle"
             color="#ffffff" color.disabled="#555555"
             fontWeight="bold"
             left="2" right="2" top="2" bottom="2">

        <s:filters>
            <s:DropShadowFilter blurX="3" blurY="3" alpha="0.5" distance="1" distance.down="0" angle="90" excludeFrom="disabled" />
        </s:filters>
    </s:Label>

</s:SparkButtonSkin>
_action1Button = new Action1Button();
view.actionGroup.addElement(_action1Button);
_action1Button.enabled = false;
<s:Button skinClass="TestSkin" enabled="false" />