Flex中效果动画结束后怎么办?
我是 Flex 的初学者,所以必须有更优雅的方法来做到这一点。
//move effect
private var m:Move = new Move();
//this function creates labels with some text and starts move effect on them
public function moveText(i:int):void {
var myLabel:Label = new Label();
myLabel.text = "some text";
m.target = myLabel;
...
m.play();
}
moveText 方法是循环调用的,所以我猜标签不会被“垃圾收集”。
我想要做的是在播放动画结束后删除在 moveText 方法中创建的标签。
另一种方法可能是创建某种标签“池”,我将用它来移动周围的文本。我不知道如何将标签返回到“池”。
问题是效果动画结束后怎么办?
I'm a beginner in Flex so there must be more elegant way of doing this.
//move effect
private var m:Move = new Move();
//this function creates labels with some text and starts move effect on them
public function moveText(i:int):void {
var myLabel:Label = new Label();
myLabel.text = "some text";
m.target = myLabel;
...
m.play();
}
Method moveText is called in a loop so I guess that labels don't get "garbage collected".
What I want to do is to remove Labels created in moveText method after play animation ends.
Another way of doing this is maybe creating some kind of "pool" of labels which I would use to move arround text. I don't know how would I return labels in to "pool".
The question is how to do something after effect animation ends?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以监听
EffectEnd
事件。请查看此处
You can listen to the
EffectEnd
event.Check out here
查看 Effect 类中的 effectEnd 事件。您可以在其中放置一个处理程序来执行垃圾收集。
Look at the effectEnd event in the Effect class. You can put a handler in there that does your garbage collection.