var varInMc:Number = MainTimeline(root).varInTimeline;
紅色的是重點,籃色部分隨意改囉!
同時適用於function,亦可延伸至movie clip裡的movie clip!
枉我試了一堆都不對的:root, root1, this.parent, parent, stage, MainTimeline
重點摘錄:
'root' returns a DisplayObject instance.
DisplayObject Class does NOT contain a property names "varInTimeline" but Your DocumentClass does, usually called: "MainTimeline".
來源(其實解答也很精簡):How to access Main Timeline variable from Movie Clip?
P.S. 標題用中文看上去好怪喲!
沒有留言:
張貼留言