(scope issue) should be simple, brain hurts

i’m trying to pass the “i” looping variable into the last function in this code (the button on release function)

for some reason I can’t figger it out…(keeps loading the value from the last xml node) help!

stop();
//create new loadVars object to call PHP file and new XML object to hold results)
var loadModels = new loadVars();
var models_xml = new XML();
models_xml.ignoreWhite=true;

//set variables for thumbnail spacing
var columns=7;
var thumb_spacing = 135;
//set .onLoad function for when xml loads
models_xml.onLoad = function (success)
{
    if (success)
    {trace(this);
	trace(this.status);
//create an array from main childnodes
		totalModels = models_xml.firstChild.childNodes;
//loop through childnodes of array
   	 for (var i=0; i<totalModels.length; i++) {
//attach clips for each model node
      item = _root.holder.attachMovie("thumbClip", "thumbClip" + i, i);
      item._x = (i%columns)*85;
      item._y = Math.floor(i/columns)*thumb_spacing;
//assign variables to xml attributes	  
	var firstName = totalModels*.attributes.First_Name;
	var ModelWire = totalModels*.attributes.Modelwire
	var lastName = totalModels*.attributes.Last_Name;
	var thumbToLoad = totalModels*.attributes.Filename;
	
//item.thumbHolder.loadMovie(thumbToLoad);
item.largeviewtoload=largeviewtoload;
item.thumbFirstName.text=firstName;
item.thumbLastName.text=lastName;
//create a function for thumbnail button  THIS IS THE PROBLEM!
item.ThumbButton.onRelease=function(){
	_root.detailsClip.gotoAndPlay("in");
	_root.holder._alpha=20;
	_root.detailsClip.firstName = totalModels;
	_root.detailsClip.lastName = lastName;
	_root.detailsClip.ModelWire = ModelWire;

	
	

	 }}}}
       
//trigger loadvars/xmlload
loadModels.sendAndLoad("http://www.yyyyyy.com/test/models.php", models_xml);