Whats wrong with these loops?

I have some code that seems to have a problem. I can’t seem to pass the x variable from one loop to within another loop.



var myLv = new LoadVars();
var myNv = new LoadVars();


	
myLv.sendAndLoad("buynowmodels.php", myLv, "POST");
myLv.onLoad = function(success)
	{

		displayprices();
	}


function displayprices() {
	
	for(x=0;x<myLv.n;x++) {
		
			new_mc = priceList.attachMovie("price_slot", "mc_"+x, x);
			new_mc.modelName.text = myLv["modelname"+(x)];
			new_mc._y = (150*x);
			
			
			myNv.sendAndLoad("buynowread.php", myNv, "POST");
			
			myNv.onLoad = function(success) {
			
			for(p=0;p<myNv.n;p++) {
			
			new_price= _root.priceList["mc_"+x].listContainer.attachMovie("list_item1", "price_"+p, p);
			new_price._y = (25*p);
			
		
			}
			}
		
			

		}
	}


Everything works fine if you change this line with x in it:


new_price= _root.priceList["mc_"+x].listContainer.attachMovie("list_item1", "price_"+p, p);

to this with an integer



new_price= _root.priceList["mc_"+1].listContainer.attachMovie("list_item1", "price_"+p, p);


but I want it to happen for all values of x not just one movie clip.

Any help would be much appreciated.

Thank you.