Retreiving Object properties from Objet Array

Hi, everyone, I’m new here. I’ve been checking out the Kirupa tutorials and the forums, looks really helpful.

I do have a question–I’ve been banging my head against this problem in a few areas. This is Actionscript 2 in Flash 8 and CS3.

I’m basically loading an XML file to assign instances of a movie clip a distinct value, which it uses to modify its height.

So, I’m looping through the xml and instantiating my class Object each time (Rect) and then placing that Object into an array:

function loadXML(loaded){
    if(loaded){
        var boxArray:Array;
        xmlNode = this.firstChild;
        sections = xmlNode.childNodes.length;
        trace("sections = " + sections);
        for(i=0;i<sections;i++){
            var thisYear:Number = xmlNode.childNodes*.firstChild.childNodes[0].nodeValue;
            var coal:Number = xmlNode.childNodes*.firstChild.nextSibling.childNodes[0].nodeValue;
            contain.attachMovie("scalerBox", "scaler", i+100);
            //"contain" is an empty movieClip on the stage.
            var boxyGuy:Rect = new Rect(contain, i, coal);
            // parameters in Rect are (targetMC, listPosition, value)
            trace("boxyGuy"+i+" created");
            boxyGuy.setCoalHeight();
            boxyArray.push(boxyGuy);
        }
    }
}

The problem is, later, when I’m outside the for loop I’m trying to get back the values of Objects in the boxyArray and it keeps coming up as undefined. Btw, I’m trying make the object instance that is rolled over change to a textFormat that is in the Rect Object class.

So, I’m trying to run through the array this way:

for(i=0;i<sections;i++){
            trace(boxyArray*);
            boxyArray*.onRelease = function(){
              dosomestuff, etc.
            }
        }

the trace here always comes up undefined. “listPosition” in this bit is an Rect parameter, defined in the previous bit of code as “i”, so I can keep track of the order of the stack.

I’ve found one or two examples of putting objects into an array and getting them back out, but it doesn’t seem to work with this, maybe because I’m using a class. I don’t know.

Any ideas? Could this be an area where I need to use the array access brackets, like around the movie clip the object is loaded into. I’ve tried everything I can think of – referencing back to the movieclip, adding extra objectRef type parameters… nothing has worked yet.

Thanks, and I hope I can contribute to the community here!