Returning all the objects in a clip in AS3

Found this great wee piece of code that’ll let you return all the items in a movieclip.

var target_mc:MovieClip = this;
for (var i:uint = 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));
}

Source: http://www.matthijskamstra.nl/blog/index.php/2008/04/30/as2-to-as3-get-all-objects-in-a-movieclip/

Tech Reference:

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑