這裏是我的應用程序結構:如何訪問父定義的對象,從子滑塊的MovieClip
parent->[slider->[movieClip1,movieClip2,movieClip3]]
所以我基本上有一個滑塊組件內的幾個影片剪輯。
現在我在父時間線
var myObj:Object = new Object();...
我想從movieClip1訪問該對象在滑塊組件中定義的對象。
我已經試過:
trace(MovieClip(this.parent).myObj.A_function_in_the_object());
,輸出:
TypeError: Error #1034: Type Coercion failed: cannot convert fl.controls::[email protected] to flash.display.MovieClip. at SliderTrack_skin/frame1()
而且
trace(parent.myObj.A_function_in_the_object());
,輸出:
1119: Access of possibly undefined property myObj through a reference with static type flash.display:DisplayObjectContainer.
如何訪問對象這是從父級時間軸中定義的兒童動畫片段?
仍輸出相同的錯誤。 – user2981
我可以知道'myObj'和'movieClip1'的框架已經定義了嗎? – Moorthy