→ heerodream:再問一下..如果是用new產生的MovieClip要怎麼取到root 08/05 17:21
→ heerodream:的影格變數..我用trace(this.root)出現null.... 08/05 17:22
DisplayObject.root屬性要當這個物件被加到顯示清單裡面時才會有效
也就是你新產生的MovieClip必須直接或間接是root的child才可以
否則都只會是null
stage, parent也有類似特性
Ticore有寫篇說明這些屬性特性的文章
http://ticore.blogspot.com/2007/08/as3-displayobject.html
你可以監聽Event.ADDED_TO_STAGE來確保root不會是null
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.124.85.205
※ 編輯: cjcat2266 來自: 59.124.85.205 (08/05 17:40)
推 skylight68:那個屬性特性的文章是之前一直想了解的@@原來有文章 08/05 18:33