Hello, someone on this site helped me set up a simple Paypal cart. It works fine when all my items are contained within the same frame. However, if I have several frames which each have their own items for purchase, the cart gets reset each time the playhead advances to that new frame. Here is the code:

Code:
var lvSend:LoadVars = new LoadVars();//do not change
lvSend.business = "[email protected]"; //your paypal email address here 
lvSend.currency_code = "USD"; //the currency you would like to use



//define items, their prices, quantity in basket and there associated movieclips
var aItem:Array = new Array();
	aItem["PGA Poster"] = {instance:mcPgaposter, price:12, quantity:0};
	aItem["PGA Print"] = {instance:mcPgaprint, price:35, quantity:0};
	aItem["PGA Shirt Med"] = {instance:mcPgamed, price:20, quantity:0};
	aItem["PGA Shirt Lg"] = {instance:mcPgalarge, price:20, quantity:0};
	aItem["PGA Shirt XL"] = {instance:mcPgaxlarge, price:20, quantity:0};
	aItem["PGA Shirt XXL"] = {instance:mcPgaxxlarge, price:20, quantity:0};
	//-----------------------DO NOT CHANGE UNLESS FAMILIAR WITH ACTIONSCRIPT--------------------//	
	
	
var totalPrice:Number;

for (var i in aItem) {
	var currentProduct:String = i;
	aItem[i].instance.id = currentProduct;
	
	aItem[i].instance.onRelease = function() {
                        
                                    //it has been added to basket so increase quantity in basket
                                    aItem[this.id].quantity++;
                                    
                                    //update datagrid
                                    updateDatagrid();
                                    
};
}


//--------------------------------------- functions ----------------------------------------------//


function updateDatagrid():Void{
	totalPrice = 0;
	var aBasket:Array = new Array();
	for (var i in aItem) {
	if(aItem[i].quantity > 0 ){
	   aBasket.push({Product: aItem[i].instance.id, Quantity: aItem[i].quantity, Price: aItem[i].price * aItem[i].quantity });
	   totalPrice += aItem[i].quantity * aItem[i].price;
	}
}

	basketInfo.dataProvider = aBasket;
	basketInfo.vScrollPolicy = "auto";
	tTotal.text = totalPrice;
}
What do i do???

PS- there is also this code to send the info to Paypal but I didn't include it to increase legibility. Here it is just in case:

Code:
mcPaypal.onRelease = function():Void{
	//send variables to paypal

	//CONSTANTS
	lvSend.cmd = "_cart";
	lvSend.upload = "1";
	
	var j:Number = 1;
	for (var i in aItem) {
		if(aItem[i].quantity > 0){
			lvSend["item_name_"+j] = aItem[i].instance.id;
			lvSend["amount_"+j] = aItem[i].price;
			lvSend["quantity_"+j] = aItem[i].quantity;
			j++;
			}
			
	}
	lvSend.send("https://www.paypal.com/cgi-bin/webscr", "_self", "POST");
}