1
我试图创建状态之间的转换。第一个状态转换工作正常(状态1 =>状态2),但第二状态转换很奇怪(状态2 =>状态3)。点击按钮更改 state2 => state3后,某些属于state2的文本区域出现并保留在屏幕上。我不知道为什么。如果有人能帮助我,我将不胜感激。Flex状态转换
我的代码。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
protected function btn1_clickHandler(event:MouseEvent):void
{
currentState="state2";
}
protected function btn2_clickHandler(event:MouseEvent):void
{
currentState="state3";
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:states>
<s:State name="state1"/>
<s:State name="state2"/>
<s:State name="state3"/>
</s:states>
<s:transitions>
<s:Transition toState="state2" >
<s:Parallel>
<s:Move targets="{[btn1,btn2]}" />
<s:AddAction targets="{[label1,label2,label3,textInput1,textInput2,textInput3]}" />
<s:Fade targets="{[label1,label2,label3,textInput1,textInput2,textInput3]}"/>
</s:Parallel>
</s:Transition>
<s:Transition toState="state3" >
<s:Fade targets="{[label1,label2,label3,textInput1,textInput2,textInput3]}"/>
</s:Transition>
</s:transitions>
<s:Label y="10" text="label1" id="label1" includeIn="state2" />
<s:TextInput y="30" id="textInput1" includeIn="state2" />
<s:Label y="50" text="label1" id="label2" includeIn="state2" />
<s:TextInput y="70" id="textInput2" includeIn="state2" />
<s:Label y="90" text="label1" id="label3" includeIn="state2" />
<s:TextInput y="120" id="textInput3" includeIn="state2" />
<s:Button y="180" y.state2="350" label="btn1" id="btn1" click="btn1_clickHandler(event)"/>
<s:Button y="250" y.state2="550" label="btn2" id="btn2" click="btn2_clickHandler(event)"/>
</s:Application>
谢谢。我刚刚更新了我的代码。我确实有我的includeIn在我的组件中。我甚至卸载我的flex并重新安装,因为我认为这是flex的小故障...动画完全把我扔了..但是+ 1 ...首先 – FlyingCat 2010-06-19 13:53:01
顺便说一句。所有这些奇怪的行为发生只是因为我添加“
”如果我删除其中的一个,动画的作品是正确的,除了他们都在同一时间播放... – FlyingCat 2010-06-19 14:02:36你可以提供可运行的代码证明问题?例如,您的状态被定义为a,b和c,但这些组件只能引用名为“addRecommend”的状态和转换。当我添加一个名为addRecommend的状态时,我得到了一个关于名为dataGrid的未定义属性的错误。 – JeffryHouser 2010-06-19 15:04:01