开发者

How to access variable of parent movie clip in Action script 3.0

How to access variable of parent movi开发者_运维百科e clip in child movie clip in Action script 3.0

Thanks.


Same way you would access a variable of any object, using parent as the target object. Because the parent property is of type DisplayObjectContainer, you will need to cast it to MovieClip like so:

trace((parent as MovieClip).myvar);

The reason for the need to cast to MovieClip is that it is dynamic, meaning you won't get compile-time errors for attempting to access properties that the compiler doesn't know about.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜