Flash中,动作3:获得被包含在一个影片剪辑的所有影片剪辑 [英] Flash, ActionScript 3: get all movieclips that are containing in a movieclip
问题描述
恐怕只是说我有一个影片剪辑,其中,含有影片剪辑B1,B2,B3,B4,B5
Lest just say i have a movieClip A which contains movieClips B1,B2,B3,B4,B5
我写code下接受一个包含所有影片剪辑和打印一样有名字。
I write code in A to receive all movieclips that a contains and like print there name.
我想这没有更迭:
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 **
谢谢, Matthy
thanks, Matthy
推荐答案
我不知道如果我完全理解你正在尝试做的,但你可以做这样的事情从父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:
for(var i:int = 0; i < target_mc.numChildren; i++) {
trace (target_mc.getChildAt(i).name);
}
您也可以拉出更多的信息,如对象的东西种类多一点冗长:
You can also pull out more information such as the type of object with something a little more verbose:
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));
}
这篇关于Flash中,动作3:获得被包含在一个影片剪辑的所有影片剪辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!