以免说我有一个 movieClip A,其中包含 movieClip B1、B2、B3、B4、B5
我在 A 中编写代码来接收 a 包含的所有影片剪辑并打印名称。
我尝试了这个但没有成功:
for each (a:MovieClip in this)
trace(a.name);
有谁知道如何让它工作。
** 请注意,跟踪名称实际上是一个示例,我想对对象本身做非常不同的事情,例如更改可见性等 **
谢谢,
马蒂
我不确定我是否完全理解你想要做什么,但你可以这样做,从父 movielcip 中提取它们的实例名称:
for(var i:int = 0; i < target_mc.numChildren; i++) {
trace (target_mc.getChildAt(i).name);
}
您还可以提取更多信息,例如具有更详细信息的对象类型:
for(var i:int = 0; i < target_mc.numChildren; i++) {
trace ('\t|\t ' +i+'.\t name:' + target_mc.getChildAt(i).name + '\t type:' + typeof
(target_mc.getChildAt(i))+ '\t' + target_mc.getChildAt(i));
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)