Flash,ActionScript 3:获取影片剪辑中包含的所有影片剪辑
以免说我有一个包含电影剪辑 B1、B2、B3、B4、B5 的电影剪辑 A,
我在 A 中编写代码以接收 a 包含的所有电影剪辑并打印名称。
我尝试了这个但没有成功:
for each (a:MovieClip in this)
trace(a.name);
有谁知道如何让它工作。
** 请注意,跟踪名称实际上是一个示例,我想对对象本身做非常不同的事情,例如更改可见性等 **
谢谢, 马蒂
Lest just say i have a movieClip A which contains movieClips B1,B2,B3,B4,B5
I write code in A to receive all movieclips that a contains and like print there name.
i tried this with no succes:
for each (a:MovieClip in this)
trace(a.name);
does anyone know how to get this working.
** note the trace name is actually an example i want to do very different things with the objects itself like changing there visibility and such **
thanks,
Matthy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需在语句之外声明变量即可。
You just needed to declare the variable outside the statement.
我不确定我是否完全理解您要做什么,但是您可以执行类似的操作从父 movielcip 中提取它们的实例名称:
您还可以提取更多信息,例如带有以下内容的对象类型:更详细一点:
I'm not sure if I completely understand what you're trying to do, but you could do something like this to pull their instance names from a parent movielcip:
You can also pull out more information such as the type of object with something a little more verbose: