XML gallery thumbnails

The simple Aim of this exercise is an XML gallery, where thumbnails are loaded up first into a grid pattern, from which when clicked, activates the load of the picture of interest.

It goes wrong noted in the AREA IN TROUBLE bellow. When I click a thumbnail, it doesn’t remember it’s assigned number - which is required to call the location of the bigger graphic …

xmlThumbs = new XML();
xmlThumbs.ignoreWhite = true;
xmlThumbs.onLoad = loadTHUMBS;
xmlThumbs.load("dance_thumbs.xml");

function loadTHUMBS(loaded){
    if (loaded) {
        thumbNode = this.firstChild.childNodes;
        Ttotal = thumbNode.length;
        thumb = *;
        link = *;
        
        for (i=0; i<Ttotal; i++) {
            thumb* = thumbNode*.attributes.thumb;
            link* = thumbNode*.attributes.link;
            
        }
        setThumbs();
    } else {
        trace("file not loaded!");
    }
}
    
function setThumbs(){
    var thumbW:Number = 60;
    
    for (i=0;i<Ttotal;i++){
        var thumbPOS:Number = i*thumbW;
        
        _root.attachMovie("thumb","thumb"+i+"_mc",1000+i,{_x:(410+thumbPOS)});
        _root["thumb"+i+"_mc"].place_mc.loadMovie(thumb*);
        
/////////////////////////////////AREA IN TROUBLE//////////////////////////////////////        
        _root["thumb"+i+"_mc"].onRelease = function(){
            
            trace(this);//i is between 0 - 3 (correct) for thumb*_mc
            trace(i);//i is ALWAYS 4 onRelease .. 
            //IF thumb2_mc was clicked - I want i = 2
            //IF thumb3_mc was clicked - I want i = 3
            //what is going wrong?
/////////////////////////////////AREA IN TROUBLE//////////////////////////////////////        
            frame_mc._alpha = 100;
            var mcLoader:MovieClipLoader = new MovieClipLoader();
            var loadListener:Object = new Object();
            mcLoader.addListener(loadListener);
            mcLoader.loadClip(link*,Image_mc);
            
            loadListener.onLoadInit = function(){//placement of images
            }
        }
    }
}

I’ve simplified my code down to this … The tagged ‘‘area in trouble’’ is what I can’t understand.
Please HELP!!:d: