在flex中添加或删除子控件时如何触发过渡效果?
我有一个自定义组件,根据用户单击的按钮动态添加和删除子组件。我想做的是触发一个过渡效果,在添加子组件时将其移动到舞台上,然后在删除时将其移走。
有人有关于如何实现这一目标的好例子吗?
编辑:我想通了并在下面留下了我的解决方案。我希望它对其他人有帮助!
I've got a custom component that has children components dynamically added and removed to it depending on what button the user clicks. What I would like to do is trigger a transition effect that moves the child component onto the stage when it's added and then moves it off when it's removed.
Does anyone have a good example on how to accomplish this?
Edit: I figured it out and left my solution below. I hope it helps someone else!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚想出了如何让它发挥作用。这是我想出的答案。我希望它能帮助其他有同样问题的人!
MyContainerComponent
是我要添加子控件的父控件,MyCustomChildControl
是我要显示其过渡的控件。moveIn
和moveOut
参数是我创建的过渡效果。I just figured out how to get this working. Here's the answer I came up with. I hope that it helps someone else that has the same question!
MyContainerComponent
is the parent control I'm adding the children controls to andMyCustomChildControl
is the control I want to show the transitions for. ThemoveIn
andmoveOut
arguments are the transition effects I've created.