user_78361084
user_78361084

Reputation: 3908

ArgumentError: Undefined state 'normalAndInactive'

I have a webapp that works great. I am now trying to make a desktop version for our internal use. I've converted it and changed the tag to a "WindowedApplication". When I try to run the Air app I get the error:

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]

I don't have a 'normalAndInactive' state in my app. I tried putting one in my application and that didn't do anything. What am I doing wrong?

EDIT: I found a bit more information. In debugging mode, the error is pointing to my custom background skin, which is as follows:

<?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>

Upvotes: 0

Views: 3015

Answers (2)

Alexander G
Alexander G

Reputation: 1

use this one instead

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

Upvotes: 0

JeffryHouser
JeffryHouser

Reputation: 39408

When creating a skin class for a component (in this case, WindowedApplication) your Skin class must implement all states that the component class expects. In this case, disabledAndInactive and normalAndInactive are the two you haven't implemented. See the full list.

Fix the error by adding those states to your skin class:

<s:states>
    <s:State name="normal" />
    <s:State name="disabled" />
    <s:State name="normalAndInactive " />
    <s:State name="disabledAndInactive " />
</s:states>

Whether any more of the states are implemented or not doesn't matter much.

Upvotes: 4

Related Questions