Flex 3 播放效果已从Stage 中移除
我正在使用removeChildAt()从WindowedApplication中删除一个组件,并且想要播放一个效果(在组件内定义,例如mx:Resize),该效果在删除之前将组件(水平盒)的高度降低到0。
我在组件中使用了removedFromStage事件,但它只是消失了(没有播放效果)。我猜它在效果播放之前就被删除了。有没有办法在removeChild函数完成之前播放效果,最好是在组件中定义?
谢谢。
I'm removing a component from the WindowedApplication, using removeChildAt(), and want to play an effect (defined within the component, say mx:Resize) which reduces the height of the component (an hbox) to 0 before it is removed.
I was using the removedFromStage event within the component, but it just disappears (without playing the effect). I guess it's being removed before the effect is played. Is there a way to play the effect, which is preferably defined in the component, before the removeChild function completes?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
removedFromStage 将在组件被删除后被触发(适用于清理/内存管理)。大多数 Flex 组件都有一个 removedEffect 属性。这就是您想要使用的。
removedFromStage is going to be fired after the component has been removed (appropriate for cleanup/memory management). Most Flex components have a removedEffect property. This is what you want to use.
我将效果移至父级,这样:
这有效。当我在组件本身中产生效果时,这不起作用,唉。
I moved the effect to the parent so:
This works. When I had the effect in the component itself, this didn't work, alas.
请查阅 Flex Builder 下的 mx.effects.Resize 类帮助页面,并查看事件列表。
基本上,您需要对代码执行的操作是:
创建调整大小事件。
为效果结束添加事件监听器
播放效果
当效果结束时关闭窗口。
p>
代码应如下所示:
注意:当您显示窗口时,不要忘记设置高度,否则它将保持为 0,您将什么也看不到!
Please consult the mx.effects.Resize class help page under Flex Builder, and see the events list.
Basically what you need to do with your code is:
create the resize event.
add an event listener for the effect end
play the effect
when the effect ended you close the window.
The code should look like:
NOTE: WHEN YOU SHOW THE WINDOW DO NOT FORGET TO SET THE HEIGHT, ELSE IT WILL REMAIN 0 AND YOU WILL SEE NOTHING!