It's only giving me one output showing the end of the array.
It's for a paypal checkout. I will need to start at item_1. I'll be happy to share the complete code with you if you want.
ActionScript Code:
for(var n:
int =
1; n < cartList.
length; n++
)
{
trace(cartList.
getItemAt(n
).
label)
// Here you define the URL address you want to connect to
var url:
String =
"PAYPAL SITE";
// Define the URLRequest object and use url string from above
var payPal:URLRequest =
new URLRequest
(url);
// Set up URL variables object and start claiming all variable names and value pairs
// See paypal documentation for adjustments in these name value pairs as you need them
var variables:URLVariables =
new URLVariables
();
variables.
cs = n;
variables.
cmd =
"_cart";
variables.
upload = n;
variables.
business =
"[email protected]";
// your merchant email at paypal
// Assign a variable name for our URLVariables object
var phpVariables:URLVariables =
new URLVariables
();
// Build the varSend variable
// Be sure you place the proper location reference to your PHP config file here
var varSend:URLRequest =
new URLRequest
("SITE");
varSend.
method = URLRequestMethod.
POST;
varSend.
data = phpVariables;
// Build the varLoader variable
var varLoader:URLLoader =
new URLLoader;
varLoader.
dataFormat = URLLoaderDataFormat.
VARIABLES;
trace("item_name_" + n
);
variables
["item_name_" + n
] =
list.
selectedItem.
TitleLabel;
variables
["amount_" + n
] =
list.
selectedItem.
Price;
//variables.amount_1 = list.selectedItem.Price; // Set the price here
phpVariables.
songPriceL1 =
list.
selectedItem.
Price;
// Place all the variables above into a data packet of the URLRequest var
payPal.
data = variables;
//Set the method to be 'POST' for sending the variables to paypal server
//payPal.method = URLRequestMethod.POST;
// And finally we navigate to the PayPal Gateway Page for your biz
navigateToURL
(payPal,
"_new");
// Same window method, no popup(recommended)
// Send the data to the php file
varLoader.
load(varSend
);