AS3从类中修改stage对象 [英] AS3 Modify stage Objects from a class

查看:183
本文介绍了AS3从类中修改stage对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在外部类中,我试图修改一个阶段对象的属性,苹果。我想将它设置为可见,因此我把我的代码:

In an external class i'm trying to modify a property of a stage object, Apple. I want to set it visible so i put in my code:

Apple.visible =true;

但是它说苹果没有定义,可能是因为它不参加第一阶段。

but it says that Apple is not defined, probably because it doesn't refeers to the stage one... how can I "import" it in my class?

推荐答案

尝试类似:

DisplayObjectContainer(stage.getChildAt(0)).getChildByName("Apple").visible = true;

其中 stage.getChildAt(0) 主时间轴电影,包含所有内部对象。

where stage.getChildAt(0) is "Main Timeline" movie, that contains all inner objects.

这篇关于AS3从类中修改stage对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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