2011-10-29 67 views
0

我有一個很棒的web應用程序。我現在正在嘗試製作供我們內部使用的桌面版本。我已經轉換它並將標籤更改爲「WindowedApplication」。當我嘗試運行AIR應用程序出現錯誤:ArgumentError:未定義狀態'normalAndInactive'

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> 

回答

3

當創建一個組件的外觀類(在這種情況下,WindowedApplication)你的皮膚類必須實現所有國家的組件類期望。在這種情況下,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> 

無論任何更多的是實現狀態的或不是沒有多大意義。

+0

THX!有趣的是,當我製作桌面應用程序時,我只會遇到錯誤。 –

+0

@ user522962在Web應用程序中;您的頂級應用程序很可能是未定義normalAndInactive或disabledAndInactive的外觀狀態的Application標記。因此,如果這些狀態沒有定義,Web應用程序不會拋出錯誤。 – JeffryHouser

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> 
+0

這會完成什麼? – JeffryHouser