Flex 中是否有一个事件会在 mx:state 标记中的所有操作完成时触发?
让我们看下一个例子:
<mx:State name="sayHello">
<mx:SetProperty name="preText" target="{this}" value="Hello"><mx:SetProperty>
</mx:State>
我能以某种方式知道 preText 属性何时设置为 hello 吗?
已经尝试过: 状态->激活 状态->进入状态 state->exitState
和
UIComponent->currentStateChange
在上述所有情况下,pretext 属性为 null,无论如何,稍后它会获得所需的值(我用计时器进行了测试)
任何帮助都会很棒! 谢谢!
Let's take the next example:
<mx:State name="sayHello">
<mx:SetProperty name="preText" target="{this}" value="Hello"><mx:SetProperty>
</mx:State>
Can I somehow know when preText property has been set to hello?
Already tried with:
state->activate
state->enterState
state->exitState
and
UIComponent->currentStateChange
In all the cases above,pretext property is null, how ever somehow, later on it gets the desired value (I tested with a timer)
Any help would be great!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很难说。 Flex 框架实现的大多数属性都会调度 propertyChangedEvent。因此,在这种情况下,您可以监听相关组件上的 preTextChanged 事件,让您知道属性已更改。
如果这是您自己实现的属性,只需让属性设置方法分派事件,如下所示:
添加监听器,如下所示:
如果不定义事件,您将无法监听 MXML 中的属性更改事件事件的元数据;大多数组件都懒得为 propertyChanged 事件定义元数据。
改变状态的行为可能需要时间。由于 Flex/Flash Player 的异步特性,如下所示:
跟踪值很可能尚未设置,因为状态更改处理尚未发生。您也许可以收听 currentStateChange< /a> 不过,事件。当调度时,您的属性都应该被修改。
It is tough to say. Most properties implemented by the Flex Framework dispatch a propertyChangedEvent. So, in this case you could listen to preTextChanged event on the component in question to let you know that the property changed.
If this is a property you implemented yourself, just make the properties set method dispatch the event, like this:
Add the listener like this:
You won't be able to listen to the property change event in MXML if you don't define event metadata for the event; and most components do not bother to define metadata for the propertyChanged event.
The act of changing a state can take time. Due to the asynchronous nature of Flex/Flash Player something like this:
The trace value will most likely not be set yet because the state change processing did not occur yet. You may be able to listen to the currentStateChange event, thoug. When that dispatches your properties should all be modified.