0

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>
user_78361084
  • 3,538
  • 22
  • 85
  • 147

2 Answers2

4

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.

JeffryHouser
  • 39,401
  • 4
  • 38
  • 59
  • thx! it's funny that I only get an error when I make a desktop app. – user_78361084 Oct 30 '11 at 00:07
  • @user522962 In a web app; your top level application is most likely the Application tag which does not define the skin states of normalAndInactive or disabledAndInactive. Therefore the web app doesn't throw an error if those states are not defined. – JeffryHouser Oct 30 '11 at 00:23
0

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>