Hello,

I'm adding movie clips (squares) using addChild. I'm also adding sub-clips (circles) to the main square clip.

Then, to reference those movie clips, I'm using a "dynamic variable" method, for easier coding (i.e., holderObject["as1"], holderObject["as2"], etc.).

The problem is that I'm trying to read the number of objects in holderObject. When I use holderObject.numChildren, it returns 0.

Is there an easy way to get the number of objects in holderObject, similar to an array (holderObject.length)? Thank you.


Code:
// MC1 is a square-shaped object; MC2 is a circle-shaped object
var holderObject:MovieClip = new MovieClip();

// Add first main object
var tempObject1:MC1 = new MC1();
addChild(tempObject1);
holderObject["as1"] = tempObject1;
// Add child object to first main object
var tempCircle1:MC2 = new MC2();
holderObject["as1"].addChild(tempCircle1);
holderObject["as1"].circle = tempCircle1;
// Position objects
holderObject["as1"].x = 50;
holderObject["as1"].circle.x = -10;

// Add second main object
var tempObject2:MC1 = new MC1();
addChild(tempObject2);
holderObject["as2"] = tempObject2;
// Add child object to second main object
var tempCircle2:MC2 = new MC2();
holderObject["as2"].addChild(tempCircle2);
holderObject["as2"].circle = tempCircle2;
// Position objects
holderObject["as2"].x = 250;
holderObject["as2"].circle.x = 50;

trace (holderObject.numChildren);