retrieve all children contained within a movieclip
AS3 October 8th, 2008Code snipplet to retieve all children contained within a movie clip:
Actionscript:
-
public function getAllChildren(target_mc):Array {
-
var childrenArray:Array = new Array;
-
for (var i:uint = 0; i <target_mc.numChildren; i++){
-
//trace ('t ' +i + ' name:' + target_mc.getChildAt(i).name + '\t type:' + typeof (target_mc.getChildAt(i)) + '\t' + target_mc.getChildAt(i));
-
childrenArray.push(target_mc.getChildAt(i));
-
-
}
-
return childrenArray;
-
}
August 19th, 2009 at 5:12 am
I just recently wrote this exact same function for a project, and now have used it on every project since.
The only difference was I used a capitol C…
October 5th, 2009 at 1:54 pm
ehm, I think it is a quite common function…