Answer the question
In order to leave comments, you need to log in
Passing array from php to flash. How to parse response in actionscript 2?
Hello, I can't parse an array that was converted to php that took the content from mysql.
The response itself (Array) from php looks like this:
{friend:'user1',status:1,relationship:'0'};{friend:'user2',status:2,relationship:'Братья'};{friend:'user3',status:0,relationship:'Коллеги'}
var firstarray:Array=new Array();
var friendsarray:Array=new Array() ;
var returner:LoadVars = new LoadVars();
var obj:Object=new Object();
on (release) {
sendXML = new XML("&login=" + escape(login));
sendXML.sendAndLoad("data/friends.php",returner,"POST");
returner.onLoad = function(success:Boolean)
{
firstarray = returner.arrayfromserver.split(";");
firstarray.sortOn(["friend", "status" ]);
for (i = 0; i < firstarray.length; i++)
{
obj=Object(firstarray[i]);
friendsarray.push(obj);
pole =pole+friendsarray[i].friend+" ";
}
};
}
Answer the question
In order to leave comments, you need to log in
There is json in actionscript. Give from php json, parse into actionscript json.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question