AS3 :: Get all Children MovieClips
It is easy in ActionScript 3 to get all the chlidren instances of a MovieClip. Take a look at the AS3 code below for help.
for (var i:uint = 0; i < mcMain.numChildren; i++){
txtOutput.htmlText += 'name:' + mcMain.getChildAt(i).name;
txtOutput.htmlText += '\t type:' + typeof (mcMain.getChildAt(i));
txtOutput.htmlText += '\t' + mcMain.getChildAt(i);
txtOutput.htmlText += "";
}
The above code uses a for loop, to loop through the total number of children in mcMain. mcMain.getChildAt(i) will get the reference to the child instance. By tacking .name to the end of mcMain.getChildAt(i) you can get the name of the child object.
download source




That was a fantastic piece of writing. I came across this article and thought it exceptionally useful.
Reply to this