【发布时间】:2010-01-11 16:39:16
【问题描述】:
我有一个具有 2 个状态的 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>
【问题讨论】:
标签: apache-flex flex3