Wow, AS2, haven't seen that in a while.
In AS2 clips that are created at runtime(via code) have positive depth values and clips that created at authortime(via Convert To Symbol) have negative depth values.
The easiest way to loop through is using for...in.
Here is an example of that wrapped in a nice reusable function, which also allows you to optionally loop through all the nested clips inside a target clip:
var clips:Array = getChildrenOf(this,true);
var numClips:Number = clips.length;
for(var i:Number = 0 ; i < numClips ; i++) trace("clip["+i+"]: " + clips[i]._name + " at depth " + clips[i].getDepth() + " in " + clips[i]._parent._name);
function getChildrenOf(target:MovieClip,recursive:Boolean):Array{
var result:Array = [];
for(var i in target){//loop through all properties
if(target[i] instanceof MovieClip) {//look for movieclips
result.push(target[i]);//found a clip add it to the result array
if(recursive) result = result.concat(getChildrenOf(target[i],true));//concatenate children of clips at this level,recurse
}
}
return result;
}
The second paramenter is optional, so if you omit it (e.g. getChildrenOf(this); ), you only get the children at the 1st level of depth inside your target movie clip (e.g. it's children, but not it's 'grandchildren')
HTH