Connecting Tech Pros Worldwide Forums | Help | Site Map

variable as POST key with URLVariables in AS3?

Newbie
 
Join Date: Aug 2008
Posts: 11
#1: Sep 15 '09
Hello,
I have an array of data objects that I would like to send from my .swf to a server-side script. I would like to loop through the array and assign a variable key name to each name-value pair, for example:

Expand|Select|Wrap|Line Numbers
  1. myVars = new URLVariables;
  2. for(i in objectArray){
  3. var keyName = 'obj_' + i;
  4. myVars.keyName = objectArray[i].data;
  5. }
  6.  
But when I try to use this method, the parser treats 'keyName' as a string.

Is it possible to do this? or do I have to write a very long switch/case statement?

Your insight is appreciated!
many thanks,
thesmithman

Reply

Tags
actionscript, key, post, urlvariables, variables