PDA

View Full Version : going through numbered variables from php in as3



rib
May 5th, 2009, 10:18 AM
hi
in as2 i could write the following to check for existing variables in a LoadVars() object called loadvarsobject in this example:


for(i=1;loadvarsobject["textvar"+i];i++){
this.["textfeld"+i].text=loadvarsobject["textvar"+i];
}with this simple process i could create whole stuctures based on the existing variables from a php file.
how do i do this in as3 using the URLLoader class?
im not asking how to get data from php to flash using URLLoade, my question is just about how go through and access numbered variables from php.

cshaheen
May 5th, 2009, 12:35 PM
It really depends on the nature of the data you are sending from PHP to AS3, and also your method of communication. Unless you are using php to generate a FlashVars embed code in the HTML page where your flash resides, the variables need to be serialized, sent via URLLoader, and then deserialized. There are lots of tools for this already available.

A quick google search brings up this one
http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/

And here is one that I would reccomend for learning to use XML for the same purpose as you require, but with much more functionality and flexibility.
http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg2.htm