Tweenlite 之后的removeChild 并没有真正起作用
我想在 Tweenlite 完成补间后通过 removeChild 删除对象。但它并没有真正起作用,因为我的对象仍然在 DisplayList 中。我无法弄清楚这个问题,所以如果有人能帮助我解决这个问题,我会非常高兴。提前致谢。:)
//TweenLite.to(sndText, .5, {alpha:0, onComplete:removeChild, onCompleteParams:[sndText]});//does not really work; still in DisplayList
TweenLite.to(sndText, .5, {alpha:0});
TweenLite.to(musicText, .5, {alpha:0});
TweenLite.to(sndSlider, .5, {alpha:0});
TweenLite.to(musicSlider, .5, {alpha:0});
TweenLite.to(okBtn, .5, {alpha:0});
TweenLite.to(sndMinus, .5, {alpha:0});
TweenLite.to(sndPlus, .5, {alpha:0});
TweenLite.to(musicMinus, .5, {alpha:0});
TweenLite.to(musicPlus, .5, {alpha:0, onComplete:removeSettings});
//removeChild(sndText); //this works but I don't know why
override public function removeSettings():void {
//removeChild doesn't really work (still in DisplayList)
removeChild(sndText);
removeChild(musicText);
removeChild(sndSlider);
removeChild(musicSlider);
removeChild(okBtn);
removeChild(sndMinus);
removeChild(sndPlus);
removeChild(musicMinus);
removeChild(musicPlus);
}
I'd like to remove objects via removeChild after Tweenlite has finished tweening. But it doesn't really work because my objects are still in the DisplayList. I can't figure out the problem so I would be very happy if someone could help me out with this problem. Thanks in advance.:)
//TweenLite.to(sndText, .5, {alpha:0, onComplete:removeChild, onCompleteParams:[sndText]});//does not really work; still in DisplayList
TweenLite.to(sndText, .5, {alpha:0});
TweenLite.to(musicText, .5, {alpha:0});
TweenLite.to(sndSlider, .5, {alpha:0});
TweenLite.to(musicSlider, .5, {alpha:0});
TweenLite.to(okBtn, .5, {alpha:0});
TweenLite.to(sndMinus, .5, {alpha:0});
TweenLite.to(sndPlus, .5, {alpha:0});
TweenLite.to(musicMinus, .5, {alpha:0});
TweenLite.to(musicPlus, .5, {alpha:0, onComplete:removeSettings});
//removeChild(sndText); //this works but I don't know why
override public function removeSettings():void {
//removeChild doesn't really work (still in DisplayList)
removeChild(sndText);
removeChild(musicText);
removeChild(sndSlider);
removeChild(musicSlider);
removeChild(okBtn);
removeChild(sndMinus);
removeChild(sndPlus);
removeChild(musicMinus);
removeChild(musicPlus);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该在删除剪辑之前调用
TweenLite.killTweensOf
:You should call
TweenLite.killTweensOf
before removing the clip: