2011-10-11 25 views
1

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); 

} 
+0

您能夠跟蹤或遇到斷點在removeSettings功能,以保證它實際上被稱爲?然後,您還可以觀察每個對象的父屬性,以查看在調用removeChild後它是否設置爲null。 – HotN

+0

您是否在輸出面板中看到任何錯誤? – Benny

+0

跟蹤在remvoveSettings函數中起作用。到目前爲止,我沒有檢查斷點事件,所以我會檢查它。目前在輸出面板中沒有錯誤。 – drpelz

回答

2

你應該刪除剪輯之前調用TweenLite.killTweensOf

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

謝謝!我會嘗試儘快(希望這有助於)!:) – drpelz

+0

killTweensOf沒有做的伎倆,但我得到了錯誤。其實這是我的錯!無意中,我跟蹤了一些孩子,但是tweenlite補間了我的對象。所以他們仍然出現在顯示列表中。我只是忘記了tweenlite使用它自己的補間引擎。我是這樣一個白癡。:/ – drpelz

+0

無論如何:)很高興你做到了! – Kodiak

相關問題