Tweenlite完成補間後,我想通過removeChild移除對象。但它並沒有真正的工作,因爲我的對象仍然在DisplayList中。我無法弄清楚問題所在,如果有人能幫我解決這個問題,我會很高興。感謝提前:)Tweenlite實際上並不起作用時的removeChild
//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);
}
您能夠跟蹤或遇到斷點在removeSettings功能,以保證它實際上被稱爲?然後,您還可以觀察每個對象的父屬性,以查看在調用removeChild後它是否設置爲null。 – HotN
您是否在輸出面板中看到任何錯誤? – Benny
跟蹤在remvoveSettings函數中起作用。到目前爲止,我沒有檢查斷點事件,所以我會檢查它。目前在輸出面板中沒有錯誤。 – drpelz