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按钮外观返回默认设置_Apache Flex_Button_Components_Skin_States - Fatal编程技术网

Apache flex Flex按钮外观返回默认设置

Apache flex Flex按钮外观返回默认设置,apache-flex,button,components,skin,states,Apache Flex,Button,Components,Skin,States,我有一个问题,在我的应用程序中发生某些操作后,蒙皮按钮将返回其默认蒙皮。下面我提供了一个部分截图,您可以在其中观察问题 单击左按钮后,它将返回其默认外观(单击会触发状态转换)。右侧按钮是默认的蒙皮按钮。请注意,我的鼠标既不在上方也不按左键 按钮外观的代码如下所示: <?xml version="1.0" encoding="utf-8"?> 以下是导致问题的转换代码: <s:Transition fromState="State0" toStat

我有一个问题,在我的应用程序中发生某些操作后,蒙皮按钮将返回其默认蒙皮。下面我提供了一个部分截图,您可以在其中观察问题

单击左按钮后,它将返回其默认外观(单击会触发状态转换)。右侧按钮是默认的蒙皮按钮。请注意,我的鼠标既不在上方也不按左键

按钮外观的代码如下所示:

<?xml version="1.0" encoding="utf-8"?>


以下是导致问题的转换代码:

        <s:Transition fromState="State0" toState="State1">
        <s:Sequence targets="{[contacts_nocontacts, contacts_list, button_contacts, button_add, button_delete, ac_vgroup]}">
            <s:Parallel>
                <s:Fade target="{contacts_nocontacts}" alphaFrom="1" alphaTo="0" duration="200" />
                <s:Fade target="{contacts_list}" alphaFrom="1" alphaTo="0" duration="200" />
                <s:Fade target="{button_add}" alphaFrom="1" alphaTo="0" duration="200" />
                <s:Fade target="{button_delete}" alphaFrom="1" alphaTo="0" duration="200" />
            </s:Parallel>
            <s:RemoveAction targets="{[contacts_nocontacts, contacts_list, button_add, button_delete]}" />
            <s:AddAction targets="{[button_contacts, ac_vgroup]}" />
            <s:Parallel>
                <s:Fade target="{button_contacts}" alphaFrom="0" alphaTo="1" duration="300" />
                <s:Fade target="{ac_vgroup}" alphaFrom="0" alphaTo="1" duration="300" />
            </s:Parallel>
        </s:Sequence>
    </s:Transition>

看起来皮肤被设置为spark.skins.spark.DefaultButtonSkin(不要与正常的按钮皮肤-spark.skins.spark.ButtonSkin混淆)。当您在按钮上设置emphasisted=“true”或该按钮用作表单中的默认按钮时,会发生这种情况


有关如何自定义强调外观的示例,请参见此线程:

问题在于,当焦点在设置为默认按钮的按钮上丢失时,外观会重置。这是一种标准行为,下面可以找到一个快速修复方法(这与Steven指出的解决方案相同,但在实际页面上更容易找到)


只需在按钮的
样式属性上附加相同的按钮skinClass。最好的方法,最快的方法就是使用上面的CSS。通过这种方式,您可以同时瞄准所有按钮

Ctrl+H
setStyle(“skinClass”
可能吧?我不明白你想说什么,请重新措辞。我不清楚这个问题。你是想将按钮返回到默认的皮肤类;还是想阻止它发生?你是如何创建按钮的?你是如何设置皮肤的?自定义皮肤背后的代码是什么?什么类型的转换你在使用吗?我正在努力防止这种情况发生。按钮是使用MXML创建的,皮肤是通过CSS全局应用的。我在问题中添加了皮肤代码。转换是按钮容器上的简单MXML火花褪色转换。上面的按钮(左)用于触发转换。该皮肤没有任何问题(尽管我不明白如果您没有在任何地方使用它,为什么要将“useChromeColor”设置为“true”),因此错误必须在其他地方。必须有人重新分配该按钮的skinclass。
        <s:Transition fromState="State0" toState="State1">
        <s:Sequence targets="{[contacts_nocontacts, contacts_list, button_contacts, button_add, button_delete, ac_vgroup]}">
            <s:Parallel>
                <s:Fade target="{contacts_nocontacts}" alphaFrom="1" alphaTo="0" duration="200" />
                <s:Fade target="{contacts_list}" alphaFrom="1" alphaTo="0" duration="200" />
                <s:Fade target="{button_add}" alphaFrom="1" alphaTo="0" duration="200" />
                <s:Fade target="{button_delete}" alphaFrom="1" alphaTo="0" duration="200" />
            </s:Parallel>
            <s:RemoveAction targets="{[contacts_nocontacts, contacts_list, button_add, button_delete]}" />
            <s:AddAction targets="{[button_contacts, ac_vgroup]}" />
            <s:Parallel>
                <s:Fade target="{button_contacts}" alphaFrom="0" alphaTo="1" duration="300" />
                <s:Fade target="{ac_vgroup}" alphaFrom="0" alphaTo="1" duration="300" />
            </s:Parallel>
        </s:Sequence>
    </s:Transition>
s|Button.emphasized {
    skinClass: ClassReference("MyNewButtonSkin");
}