我有一个flex组件,有两种状态——“”(即没有名称/默认值)和“事务性”——以及从一种状态到另一种状态的一系列转换。
有一个按钮可在两种状态之间切换,单击时调用以下函数
public function ToggleState():void
{
if (this.currentState=="Transactional")
{
this.currentState = "";
}
else
{
this.currentState = "Transactional";
}
}
除非在组件从一种状态切换到另一种状态时单击按钮,否则一切都按预期工作。在那之后事情开始变得奇怪-一些以前会消失的组件,不再消失。其他人不再出现
我怀疑这是因为转换没有正确完成,所以要设置动画的组件的属性没有正确重置为正确的值。
我试着进行一些检查,以判断状态是否正在改变(因此在播放转换时禁用按钮),但我能找到的唯一能听到的事件是
enterState
currentStateChange
currentStateChanging
所有这些都是在转换完成之前激发的。
是否有人知道任何其他适合倾听的事件或更好的方式来进行状态更改?
更新:
这是我用于转换的MXML
<transitions>
<mx:Transition fromState="" toState="Transactional">
<mx:Sequence>
<mx:Parallel>
<mx:AnimateProperty target="{Controller}" property="y" fromValue="-60" toValue="-1" duration="600" />
<mx:AnimateProperty target="{Environment}" property="y" fromValue="156" toValue="46" />
<mx:AnimateProperty target="{ProfitAndLoss}" property="y" fromValue="156" toValue="126" />
<mx:AnimateProperty target="{Summary}" property="y" fromValue="156" toValue="56" />
<mx:AnimateProperty target="{Assets_Container}" property="x" fromValue="266" toValue="246" />
<mx:AnimateProperty target="{Liabilities_Container}" property="x" fromValue="425" toValue="505" />
<mx:Fade target="{TransactionalBackgroundImage}" alphaFrom="0" alphaTo="1" />
</mx:Parallel>
<mx:AnimateProperty target="{Summary}" property="x" fromValue="42" toValue="256" />
</mx:Sequence>
</mx:Transition>
<mx:Transition fromState="Transactional" toState="">
<mx:Sequence>
<mx:AnimateProperty target="{Summary}" property="x" fromValue="256" toValue="42" />
<mx:Parallel>
<mx:AnimateProperty target="{Controller}" property="y" fromValue="-1" toValue="-60" />
<mx:AnimateProperty target="{Environment}" property="y" toValue="156" fromValue="46" />
<mx:AnimateProperty target="{ProfitAndLoss}" property="y" toValue="156" fromValue="126" />
<mx:AnimateProperty target="{Summary}" property="y" toValue="156" fromValue="56" />
<mx:AnimateProperty target="{Assets_Container}" property="x" fromValue="246" toValue="266" />
<mx:AnimateProperty target="{Liabilities_Container}" property="x" fromValue="505" toValue="425" />
<mx:Fade target="{TransactionalBackgroundImage}" alphaFrom="0" alphaTo="0" />
</mx:Parallel>
</mx:Sequence>
</mx:Transition>
</transitions>