在Tweenlite不起作用后removeChild

时间:2011-10-11 23:52:30

标签: actionscript-3 tweenlite

我想在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);

}

1 个答案:

答案 0 :(得分:2)

在删除剪辑之前,您应该致电TweenLite.killTweensOf

TweenLite.killTweensOf(sndText);
removeChild(sndText);