This seems like it should be so easy, I feel stupid asking, but I can’t figure it out:
I’m trying to pass shopping cart items to PayPal from Flash using URLVariables. PayPal reads each cart item as ‘item_name_1’, ‘item_name_2’, ‘item_name_3’, … etc. so I want to create a new ‘item_name_’ variable for each item in the shopping cart. The problem is I can’t just assign a variable as item_name_+i, so how would I go about this? Here is the code I’m using:
private function checkOut(event:MouseEvent)
{
var variables:URLVariables = new URLVariables();
for (var i:* in iList) {
[COLOR=Red][COLOR=Black]variables.[/COLOR]item_name_+i[COLOR=Black] = iList*.name;
variables.[/COLOR]amount_+i [COLOR=Black]= iList*.price;[/COLOR][/COLOR]
}
var request:URLRequest = new URLRequest("https://www.paypal.com/cgi-bin/webscr");
request.method = URLRequestMethod.POST;
request.data = variables;
navigateToURL(request);
}
Thanks for the help!