Issues with referencing objects after adding to stage through an array

Hi all,

In short: It’s a virtual fair designed in “2D” where each “stand” is loaded in through an XML document. A Box Class draws and place the objects (stands) onto the stage, and a BoxesInfo class has the purpose of generating a description from the XML document about each stand.

Here’s my problem: I wish to add an MouseOVER eventListener to each object on stage, calling the BoxesInfo. But I cant seem to get the referencing right.

Here’s my document class Messe.as


package
[COLOR=#000000]{[/COLOR]
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]events[/COLOR].[COLOR=#000000]MouseEvent[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]events[/COLOR].[COLOR=#000000]Event[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]display[/COLOR].[COLOR=#000000]Sprite[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]display[/COLOR].[COLOR=#000000]Loader[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]display[/COLOR].[COLOR=#000000]DisplayObject[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]net[/COLOR].[COLOR=#000000]URLLoader[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]net[/COLOR].[COLOR=#000000]URLRequest[/COLOR];
    [COLOR=#993300]import[/COLOR] src.[COLOR=#000000]Boxes[/COLOR];
    [COLOR=#993300]import[/COLOR] src.[COLOR=#000000]BoxesInfo[/COLOR];

    [COLOR=#993300]import[/COLOR] flash.[COLOR=#993300]text[/COLOR].[COLOR=#993300]TextField[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#993300]text[/COLOR].[COLOR=#993300]TextFormat[/COLOR];

    [COLOR=#993300]public[/COLOR] [COLOR=#993300]class[/COLOR] Messe [COLOR=#993300]extends[/COLOR] Sprite
    [COLOR=#000000]{[/COLOR]
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] box:Boxes;
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] xmlData:[COLOR=#993300]XML[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] xmlList:XMLList;
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] urlLoader:URLLoader;
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] urlRequest:URLRequest;
            
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] arrayX:[COLOR=#993300]Array[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]Array[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] arrayY:[COLOR=#993300]Array[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]Array[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] arrayModel:[COLOR=#993300]Array[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]Array[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] standeArray:[COLOR=#993300]Array[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]Array[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] arrayId:[COLOR=#993300]Array[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]Array[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] txtFmt:[COLOR=#993300]TextFormat[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] txtFld:[COLOR=#993300]TextField[/COLOR];
        
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] standInfo:BoxesInfo;
        
        [COLOR=#993300]public[/COLOR] [COLOR=#993300]function[/COLOR] Messe[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR]
        [COLOR=#000000]{[/COLOR]
            init[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        [COLOR=#000000]}[/COLOR]
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]function[/COLOR] init[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR] 
        [COLOR=#000000]{[/COLOR]
            loadContent[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        [COLOR=#000000]}[/COLOR]
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]function[/COLOR] loadContent[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR] 
        [COLOR=#000000]{[/COLOR]
            urlRequest = [COLOR=#993300]new[/COLOR] URLRequest[COLOR=#000000]([/COLOR][COLOR=#0000ff]"src/messeXML.xml"[/COLOR][COLOR=#000000])[/COLOR];
            urlLoader = [COLOR=#993300]new[/COLOR] URLLoader[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
            urlLoader.[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR]Event.[COLOR=#000000]COMPLETE[/COLOR], completeListener[COLOR=#000000])[/COLOR];
            urlLoader.[COLOR=#993300]load[/COLOR][COLOR=#000000]([/COLOR]urlRequest[COLOR=#000000])[/COLOR];
        [COLOR=#000000]}[/COLOR]
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]function[/COLOR] completeListener[COLOR=#000000]([/COLOR][COLOR=#993300]e[/COLOR]:Event[COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR] 
        [COLOR=#000000]{[/COLOR]
            xmlData = [COLOR=#993300]new[/COLOR] [COLOR=#993300]XML[/COLOR][COLOR=#000000]([/COLOR]urlLoader.[COLOR=#993300]data[/COLOR][COLOR=#000000])[/COLOR];
            xmlData.[COLOR=#000000]ignoreWhitespace[/COLOR] = [COLOR=#993300]true[/COLOR];
            xmlList = xmlData.[COLOR=#000000]children[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
            [COLOR=#f000f0]*//trace(xmlList.toString());*[/COLOR]
                [COLOR=#993300]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#993300]var[/COLOR] i:[COLOR=#993300]int[/COLOR]=[COLOR=#000000]0[/COLOR]; i<xmlList.[COLOR=#993300]length[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]; i++[COLOR=#000000])[/COLOR] 
                [COLOR=#000000]{[/COLOR]
                [COLOR=#993300]var[/COLOR] boxX:[COLOR=#993300]Number[/COLOR] = xmlList[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR][email protected];
                [COLOR=#993300]var[/COLOR] boxY:[COLOR=#993300]Number[/COLOR] = xmlList[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR][email protected];
                [COLOR=#993300]var[/COLOR] boxModel:[COLOR=#993300]Number[/COLOR] = xmlList[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR][email protected];
                [COLOR=#993300]var[/COLOR] boxId:[COLOR=#993300]Number[/COLOR] = xmlList[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR][email protected];                                arrayX.[COLOR=#993300]push[/COLOR][COLOR=#000000]([/COLOR]boxX[COLOR=#000000])[/COLOR];
                arrayY.[COLOR=#993300]push[/COLOR][COLOR=#000000]([/COLOR]boxY[COLOR=#000000])[/COLOR];
                arrayModel.[COLOR=#993300]push[/COLOR][COLOR=#000000]([/COLOR]boxModel[COLOR=#000000])[/COLOR];
                arrayId.[COLOR=#993300]push[/COLOR][COLOR=#000000]([/COLOR]boxId[COLOR=#000000])[/COLOR];                                 standeArray[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR] = [COLOR=#993300]new[/COLOR] Boxes[COLOR=#000000]([/COLOR]arrayX[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR],arrayY[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR], arrayModel[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR], arrayId[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR];
                addChildAt[COLOR=#000000]([/COLOR]standeArray[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR], [COLOR=#000000]0[/COLOR][COLOR=#000000])[/COLOR];
                standeArray[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#000000]buttonMode[/COLOR] = [COLOR=#993300]true[/COLOR];
                standeArray.[COLOR=#993300]forEach[/COLOR][COLOR=#000000]([/COLOR]onMouse[COLOR=#000000])[/COLOR]; 
                
                [COLOR=#993300]var[/COLOR] standInfo = [COLOR=#993300]new[/COLOR] BoxesInfo[COLOR=#000000]([/COLOR]arrayX[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR],arrayY[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR],arrayId[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR];
                addChildAt[COLOR=#000000]([/COLOR]standInfo, [COLOR=#000000]0[/COLOR][COLOR=#000000])[/COLOR];
                standInfo.[COLOR=#993300]visible[/COLOR] = [COLOR=#993300]false[/COLOR]; 
                [COLOR=#000000]}[/COLOR]
                
        [COLOR=#000000]}[/COLOR]
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]function[/COLOR] onMouse[COLOR=#000000]([/COLOR]element:*, arrayId:[COLOR=#993300]int[/COLOR], arr:[COLOR=#993300]Array[/COLOR][COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR]
        [COLOR=#000000]{[/COLOR]
            [COLOR=#993300]this[/COLOR].[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000000]CLICK[/COLOR], onClick[COLOR=#000000])[/COLOR]
            [COLOR=#993300]this[/COLOR].[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000000]MOUSE_OVER[/COLOR], onMouseOver[COLOR=#000000])[/COLOR]
        [COLOR=#000000]}[/COLOR]
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]function[/COLOR] onClick[COLOR=#000000]([/COLOR][COLOR=#993300]e[/COLOR]:MouseEvent[COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR]
        [COLOR=#000000]{[/COLOR]
            [COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"me too"[/COLOR][COLOR=#000000])[/COLOR];
        [COLOR=#000000]}[/COLOR]
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]function[/COLOR] onMouseOver[COLOR=#000000]([/COLOR][COLOR=#993300]e[/COLOR]:MouseEvent[COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR]
        [COLOR=#000000]{[/COLOR]
            [COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"me me me"[/COLOR][COLOR=#000000])[/COLOR];
            standInfo.[COLOR=#993300]visible[/COLOR] = [COLOR=#993300]true[/COLOR]; [COLOR=#f000f0]*//This keeps giving me error ????*[/COLOR]
        [COLOR=#000000]}[/COLOR]
    
    [COLOR=#000000]}[/COLOR]
    
[COLOR=#000000]}[/COLOR]

And my BoxesInfo.as Class


package src
[COLOR=#000000]{[/COLOR]
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]events[/COLOR].[COLOR=#000000]MouseEvent[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]display[/COLOR].[COLOR=#000000]Sprite[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]display[/COLOR].[COLOR=#000000]Graphics[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]display[/COLOR].[COLOR=#000000]Shape[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]filters[/COLOR].[COLOR=#000000]DropShadowFilter[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#993300]text[/COLOR].[COLOR=#993300]TextField[/COLOR];
    [COLOR=#993300]import[/COLOR] flash.[COLOR=#993300]text[/COLOR].[COLOR=#993300]TextFormat[/COLOR];
    
    [COLOR=#993300]public[/COLOR] [COLOR=#993300]class[/COLOR] BoxesInfo [COLOR=#993300]extends[/COLOR] Sprite
    [COLOR=#000000]{[/COLOR]
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] boxColor:[COLOR=#993300]Number[/COLOR]; 
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] boxAlpha:[COLOR=#993300]Number[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] boxXStart:[COLOR=#993300]Number[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] boxYStart:[COLOR=#993300]Number[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] xPos1:[COLOR=#993300]Number[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] xPos2:[COLOR=#993300]Number[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] boxId:[COLOR=#993300]Number[/COLOR];
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] boxModel:[COLOR=#993300]Number[/COLOR];
                
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] standBox:Sprite;
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] standInfo:Sprite;
        
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] ds:DropShadowFilter;
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]var[/COLOR] dfilter:DropShadowFilter;
        
        
    
        [COLOR=#993300]public[/COLOR] [COLOR=#993300]function[/COLOR] BoxesInfo[COLOR=#000000]([/COLOR]xPosStart:[COLOR=#993300]Number[/COLOR], yPosStart:[COLOR=#993300]Number[/COLOR], standId:[COLOR=#993300]Number[/COLOR][COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR]
        [COLOR=#000000]{[/COLOR]
        [COLOR=#993300]this[/COLOR].[COLOR=#000000]boxColor[/COLOR] = 0xFFFFFF;
        [COLOR=#993300]this[/COLOR].[COLOR=#000000]boxXStart[/COLOR] = xPosStart;
        [COLOR=#993300]this[/COLOR].[COLOR=#000000]boxYStart[/COLOR] = yPosStart;
        [COLOR=#993300]this[/COLOR].[COLOR=#000000]boxId[/COLOR] = standId;
        [COLOR=#993300]this[/COLOR].[COLOR=#000000]boxAlpha[/COLOR] = .[COLOR=#000000]8[/COLOR];
        
        [COLOR=#f000f0]*//Filter settings*[/COLOR]
        [COLOR=#993300]var[/COLOR] ds = [COLOR=#993300]new[/COLOR] DropShadowFilter[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        ds.[COLOR=#000000]distance[/COLOR] = [COLOR=#000000]1[/COLOR];
        ds.[COLOR=#000000]blurX[/COLOR] = [COLOR=#000000]5[/COLOR];
        ds.[COLOR=#000000]blurY[/COLOR] = [COLOR=#000000]5[/COLOR];
        ds.[COLOR=#000000]alpha[/COLOR] = .[COLOR=#000000]6[/COLOR];
                        
        [COLOR=#993300]var[/COLOR] infoX:[COLOR=#993300]Number[/COLOR] = boxXStart - [COLOR=#000000]20[/COLOR];
        [COLOR=#993300]var[/COLOR] infoY:[COLOR=#993300]Number[/COLOR] = boxYStart - [COLOR=#000000]150[/COLOR];
        [COLOR=#993300]var[/COLOR] standInfo = [COLOR=#993300]new[/COLOR] Sprite[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        standInfo.[COLOR=#000000]graphics[/COLOR].[COLOR=#993300]beginFill[/COLOR][COLOR=#000000]([/COLOR]boxColor, .[COLOR=#000000]5[/COLOR][COLOR=#000000])[/COLOR];
        standInfo.[COLOR=#000000]graphics[/COLOR].[COLOR=#000000]drawRect[/COLOR][COLOR=#000000]([/COLOR]infoX, infoY, [COLOR=#000000]100[/COLOR], [COLOR=#000000]100[/COLOR][COLOR=#000000])[/COLOR];
        standInfo.[COLOR=#000000]graphics[/COLOR].[COLOR=#993300]endFill[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        standInfo.[COLOR=#000000]filters[/COLOR] = [COLOR=#000000][[/COLOR]ds[COLOR=#000000]][/COLOR];
        addChild[COLOR=#000000]([/COLOR]standInfo[COLOR=#000000])[/COLOR];
        standInfo.[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000000]MOUSE_OVER[/COLOR], onMouse[COLOR=#000000])[/COLOR]
        [COLOR=#000000]}[/COLOR]
        
        [COLOR=#993300]private[/COLOR] [COLOR=#993300]function[/COLOR] onMouse[COLOR=#000000]([/COLOR][COLOR=#993300]e[/COLOR]:MouseEvent[COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR]
        [COLOR=#000000]{[/COLOR]
            
            [COLOR=#f000f0]*//trace(boxId);*[/COLOR]
            
        [COLOR=#000000]}[/COLOR]

        
    [COLOR=#000000]}[/COLOR]
    
[COLOR=#000000]}[/COLOR]

Any help and/or advice is highly appreciated! Im still learning, so its always nice to find out an easier way for the next time

Cheers

Steff