2012-08-23 164 views
0

我試圖改變一個影片剪輯的父或根內的變量中改變的變量:AS3影片剪輯的父

this(root).variable 

到目前爲止,我只遇到的錯誤,我不知道如何修復它們。變量在舞臺上。

當前的錯誤是:

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::[email protected] to flash.display.MovieClip.

有誰知道我做錯了嗎?
這似乎是對其他人的作品。

+0

任何幫助或線索將是巨大的。 –

回答

0

您是不是要找:

this.root.variable 

this.parent.variable 
+0

這實際上給我一個直接的錯誤,而不是一個類型錯誤。錯誤是:符號'無人機',圖層'層1',第1幀,第53行\t 1119:訪問可能未定義的屬性通過靜態類型的引用生命期flash.display:DisplayObject。 –

+0

您可能需要將父項轉換爲您擁有的類。 var yourClass:YourClass = this.parent as YourClass; if(yourClass) yourClass.variable = 5; –

+0

這仍然會給出錯誤,並且在跟蹤時與此(根)相同。 –

0

嘗試

Movieclip(parent).variable 
+0

這提供了相同的錯誤。 –