Re: [Flashcoders] LoadVars - sending an array

2006-08-05 Thread ben farrell
I believe it'll always come in as a string - but you can use the split 
keyword quite easily.  I pick a separator character that won't appear in 
my array like the pipes

myString =val1|val2|val3|val4|val5

Once you load the string...
myArray = myString.split('|');

So then myArray will an array full of your values.
ben

Alexander Farber wrote:

Hello,

I'm working on a flash game sending data to an Apache module
through the LoadVars.sendAndLoad()  (i.e. I use neither XML, nor AMF,
but send the application/x-www-form-urlencoded strings around).

I wonder, how do the other folks send arrays, since you
unfortunately can't send a key more than once:

   var resp_lv:LoadVars = new LoadVars();
   resp_lv.decode('my_array=1my_array=2');
   for (var key in resp_lv) {
trace('key=' + key + ', val=' + resp_lv[key]);
   }

this will print only the last one:

  key=my_array, val=2

So what do you guys use? Do you glue array elements
together using %0A or %00 or is there smth. better?

Regards
Alex
a

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] LoadVars - sending an array

2006-08-05 Thread eka

Hello :)

you can use JSON to send and receive an Array (with text format and
LoadVars)

Use JSON to format your string, serialize or deserialize your datas :

http://www.json.org/

You can use my JSON version in Vegas :
http://www.ekameleon.net/blog/index.php?2006/04/11/30--vegas-json-tout-en-couleur

PS : Vegas is my openSource framework - http://osflash.org/vegas

EKA+ :)



2006/8/3, Alexander Farber [EMAIL PROTECTED]:


Hello,

I'm working on a flash game sending data to an Apache module
through the LoadVars.sendAndLoad()  (i.e. I use neither XML, nor AMF,
but send the application/x-www-form-urlencoded strings around).

I wonder, how do the other folks send arrays, since you
unfortunately can't send a key more than once:

var resp_lv:LoadVars = new LoadVars();
resp_lv.decode('my_array=1my_array=2');
for (var key in resp_lv) {
trace('key=' + key + ', val=' + resp_lv[key]);
}

this will print only the last one:

   key=my_array, val=2

So what do you guys use? Do you glue array elements
together using %0A or %00 or is there smth. better?

Regards
Alex

--
http://preferans.de
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] LoadVars - sending an array

2006-08-04 Thread Alexander Farber

Hello,

I'm working on a flash game sending data to an Apache module
through the LoadVars.sendAndLoad()  (i.e. I use neither XML, nor AMF,
but send the application/x-www-form-urlencoded strings around).

I wonder, how do the other folks send arrays, since you
unfortunately can't send a key more than once:

   var resp_lv:LoadVars = new LoadVars();
   resp_lv.decode('my_array=1my_array=2');
   for (var key in resp_lv) {
trace('key=' + key + ', val=' + resp_lv[key]);
   }

this will print only the last one:

  key=my_array, val=2

So what do you guys use? Do you glue array elements
together using %0A or %00 or is there smth. better?

Regards
Alex

--
http://preferans.de
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com