AS3 Modify stage Objects from a class

2019-08-03 04:53发布

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?

1条回答
姐就是有狂的资本
2楼-- · 2019-08-03 05:45

Try something like:

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

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

查看更多
登录 后发表回答