XML trouble

Hey guys-

So, I’ve got an XML document that holds the info for a Press section I’m doing for a client. The XML holds the path to a thumbnail, the headline text and a link to the original article.

I’m having no problem getting the thumbnails to load in and the headline was a breeze too. Put them both in holders so I could position them later.

My trouble comes when I try to pass the link attributes to a button that also gets attached to each press clipping. I can trace out the link array that I create to hold my XML data but when I try to pass it to a getURL function inside a button in the same For loop “i” is never passed.

I figure it’s a pathing issue (which is my biggest flash downfall) I’ve tried anything I can to get it working but nothing seems to work.

Here’s my code, I’d appreciate if someone could tell me why “i” isn’t being passed into the button code:

var yPos:Number = 0;
var xPos:Number = 0;
var spacer:Number = 6;
var imgPathArr:Array = new Array();
var headlineArr:Array = new Array();
var linkArr:Array = new Array();

var pressXML:XML = new XML();
pressXML.ignoreWhite = true;

createEmptyMovieClip("content",getNextHighestDepth());

content.cacheAsBitmap = true;
mask.cacheAsBitmap = true;
content.setMask(mask);

function populateStrip():Void {
    //trace("populateStrip");
    var nodes:Array = pressXML.firstChild.childNodes;
    //
    for (i=0; i<nodes.length; i++) {
        //LOAD ARRAYS WITH XML DATA
        imgPathArr.push(pressXML.firstChild.childNodes*.attributes.path);
        headlineArr.push(pressXML.firstChild.childNodes*.attributes.headline);
        linkArr.push(pressXML.firstChild.childNodes*.attributes.link);
        //trace(linkArr);
        //CREATE HOLDERS, TEXT FIELDS AND ATTACH BUTTONS
        content.attachMovie("itemHolder","item"+i,content.getNextHighestDepth());
        content.attachMovie("headline","headline"+i,content.getNextHighestDepth());
        content.attachMovie("clickToLaunch","link"+i,content.getNextHighestDepth());
       
 //LOAD XML DATA INTO HOLDERS AND TEXT FEILDS
       content["item"+i].loadMovie(imgPathArr*);
        content["headline"+i].headline_txt.text = headlineArr*;
        trace(linkArr*);
         **content["link"+i].onRelease = function() {
            trace(linkArr*);
        };**
        //POSITION HOLDERS, TEXT FIELDS AND BUTTONS
        content["item"+i]._x = xPos;
        content["item"+i]._y = yPos;
        content["headline"+i]._x = xPos+134;
        content["headline"+i]._y = yPos-2;
        content["link"+i]._x = xPos+134;
        content["link"+i]._y = content["headline"+i]._y+14;
        
//UPDATE YPOS
        yPos = yPos+content["item"+i]._height+spacer;
        //POSITION PHOTOSTRIP
        content._x = track._x+53;
        content._y = track._y-2;
        clickToLaunch();
    }
    content.attachMovie("textSpacer","textSpacer",content.getNextHighestDepth());
    content.textSpacer._x = xpos;
    content.textSpacer._y = content._y + content._height-50;
    min = content._y;
    max = min-content._height+mask._height;

    function clickToLaunch() {
        //trace(linkArr*);
    }
}
//trace(content._height);
pressXML.onLoad = function(loaded:Boolean):Void  {
    if (loaded) {
        //INITIATE SLIDER

        //POPULATE THE STRIP *****ES!
        populateStrip();

    } else {
        trace("error reading xml");
    }
};



pressXML.load("press.xml");
  trace(linkArr*);//TRACES FINE OUTSIDE OF THE BUTTON CODE
       
 content["link"+i].onRelease = function() {
            trace(linkArr*);//ALWAYS UNDEFINED
        };

Thanks a million, I’m like 8 hours into this stupid thing!