我有一个很棒的网络应用程序。我现在正在尝试制作一个桌面版本供我们内部使用。我已将其转换并将标记更改为“WindowedApplication”。当我尝试运行Air应用程序时,我收到错误:
ArgumentError: Undefined state 'normalAndInactive'.
at mx.core::UIComponent/getState()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:10596]
at mx.core::UIComponent/findCommonBaseState()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:10616]
at mx.core::UIComponent/commitCurrentState()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:10370]
at mx.core::UIComponent/commitProperties()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:8294]
at spark.components.supportClasses::GroupBase/commitProperties()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\supportClasses\GroupBase.as:1128]
at spark.components::Group/commitProperties()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\Group.as:886]
at mx.core::UIComponent/validateProperties()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:8209]
at spark.components::Group/validateProperties()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\Group.as:864]
at mx.managers::LayoutManager/validateProperties()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:597]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:783]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
我的应用中没有'normalAndInactive'状态。我尝试在我的应用程序中放一个,但没有做任何事情。我做错了什么?
编辑:我发现了更多信息。在调试模式下,错误指向我的自定义背景外观,如下所示:<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Metadata>
[HostComponent("spark.components.Application")]
</fx:Metadata>
<s:states>
<s:State name="normal" />
<s:State name="disabled" />
</s:states>
<!-- Define a gradient fill for the background of the Application container. -->
<s:Rect id="backgroundRect" left="0" right="0" top="0" bottom="0">
<s:fill>
<s:SolidColor color="#FFFFFF" alpha=".25" />
</s:fill>
</s:Rect>
<s:Group id="contentGroup" left="0" right="0" top="0" bottom="0" />
</s:Skin>
答案 0 :(得分:3)
为组件创建外观类(在本例中为WindowedApplication)时,Skin类必须实现组件类所需的所有状态。在这种情况下,disabledAndInactive和normalAndInactive是您尚未实现的两个。 See the full list
通过将这些状态添加到皮肤类来修复错误:
<s:states>
<s:State name="normal" />
<s:State name="disabled" />
<s:State name="normalAndInactive " />
<s:State name="disabledAndInactive " />
</s:states>
是否实施了更多州并不重要。
答案 1 :(得分:0)
使用这个
<s:states> <s:State name="normal" />
<s:State name="disabled" stateGroups="disabledGroup" />
<s:State name="normalAndInactive" stateGroups="inactiveGroup" />
<s:State name="disabledAndInactive" stateGroups="disabledGroup, inactiveGroup" />
</s:states>