5/5/2010 4:52:57 AM
Title:
how to send arraycollection in php from flex
hey frnd,
how to send arraycollection in php from flex ?
is any solution thr?
thx in advanced,
abhishekchess1@gmail.com
:)
5/5/2010 5:08:32 AM
sending array collection from flex to php can be achieved by using post request. Which is similar to submitting a form .
While using the post request you can send the data by converting it to xml or some coma separated format which you can decode in php to regenerate the arrycollection in php.
5/5/2010 5:40:55 AM
hey frnd,
i have arraycollection data like arrcol([label='a',val='1'],...)
so can i fetch in same way(arracol[0].label) in php?
5/5/2010 6:19:22 AM
you can use below function to convert the arrayCollection in to string in flex and then forward this string to PHP, You have to write a code on this string to recreate it to an array collection in PHP.
public static function arrayCollectionToString( myArrayCollection:ArrayCollection ):String
{
var collStr:String
for each( var obj:Object in myArrayCollection )
{
collStr += "[";
for each( var obj2:Object in obj )
{
collStr += obj2.toString() + ", ";
}
collStr += "]";
}
return collStr;
}
Inder
Points: 2880
Posts:0
5/5/2010 6:28:29 AM
when you use httpservice or webservice to send data from flex to PHP or some other server side language. the data types are not exchangeable so they are not preserved . Which means data exchange can be done using strings only. But this is truly not a very efficient way .
Another way is using JSON with flex , check this good tutorial to see see how you can use JSON with flex and PHP to do communication with datatypes preserved
http://www.adobe.com/devnet/flex/articles/flex_php_json.html