推 cjcat2266:Flash Player使用garbage collector記憶體 03/30 12:05
→ cjcat2266:一般是無法直接"命令"garbage collector清除記憶體的 03/30 12:05
→ cjcat2266:當有需要記憶體,GC自然會去把沒用的物件清除掉 03/30 12:06
→ STARGAZERs:所以說他一切都自動@@" 03/30 12:25
→ STARGAZERs:那我在 renew 那段程式碼當中做 removeChild 沒效 03/30 12:30
→ STARGAZERs:又是甚麼原因阿@@" 03/30 12:30
推 cjcat2266:你要確定BContainer是先前addChild()在stage之下才行 03/30 13:17
→ STARGAZERs:我還挺確定的 因為 addChild 是在倒數第三行... 03/30 13:59
→ STARGAZERs:說錯 是倒數第四行 我是希望把顯示 刪除 都放在 03/30 14:00
→ STARGAZERs:同一個 function 當中@@“ 03/30 14:00
推 cjcat2266:那你怎麼先removeChild()才addChild()呢? 03/30 14:42
→ aquarianboy:當你的renew == 1的時候,會先做removeChild的動作 03/30 14:44
→ aquarianboy:這時候不會發生錯誤訊息嗎? 03/30 14:44
用修文來回答 ~
我做 removeChild 不會有錯誤訊息!!
我有想過是不是 Function 內的 Bcontainer:Sprite
只是繼承了外部 conatiner1 的一切的副本
可是我可以取消監聽 卻不能移除他 這點好奇怪喔...
※ 編輯: STARGAZERs 來自: 114.43.122.216 (03/30 16:23)
推 emily114005:renew==1時,removeChild做完又會再做一次addChild喔 03/30 16:22
→ STARGAZERs:是沒錯阿 可是重新 addchild 前我有把他變成空的阿 03/30 16:23
→ STARGAZERs:removeChild 後面的 = null 03/30 16:26
→ STARGAZERs:或是 Bcontainer = new sprite; 03/30 16:26
→ STARGAZERs:Orz 我單獨把這段 renew 拉出來就不能用了 03/30 17:06
→ STARGAZERs:會 Error... 請問哪位高手能提供一下正確的寫法嗎 03/30 17:08
→ STARGAZERs:找到問題點了... removeChild 的寫法是... 03/30 17:10
→ STARGAZERs:removeChild(); 而不是 stage.removeChild(); 03/30 17:10