如何从文档类访问舞台上的MovieClip? [英] How do I access a MovieClip on the stage from the Document Class?

查看:172
本文介绍了如何从文档类访问舞台上的MovieClip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在舞台的根目录上有一个box_mc动画片段,我需要从我的文档类中选择它。我认为Stage.getChildByName(box_mc)将工作,但它只是返回null。在您的文档类中,在构造函数中添加

解决方案

  addEventListener(Event.ADDED_TO_STAGE,init,false,0,true); 

然后在函数init中:

<$ p


$ $ $ $ $ $ $ $ $ $ $ $ $ $


I have a "box_mc" movieclip on the root of my stage and I need to select it from within my Document Class. I thought Stage.getChildByName("box_mc") would work, but it just returns null. Thanks in advance.

解决方案

in your document class, in the constructor add

addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);

then in the function init:

private function init(e:Event):void
{

    getChildByName("box_mc") 

}

这篇关于如何从文档类访问舞台上的MovieClip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆