The data conversion from PHP types to ActionScript types is presented below:
An array from PHP can be transitted in different manners to the Flash.
If the array:
- has continous indexes
- the lowest index is 0
- each entry of the array contains an array
- all the keys of the 0 index array are strings
- all the arrays have the same number of elements
- all the keys of the 0 index array are set in every other array
the array will be serialized as
recordset. This means that it will take fewer bytes to transmit it. In the ActionScript, it will be visible as an Array of Objects, with properties named as the keys of the 0 index array.
If the array
- has continous indexes
- the lowest index is 0
the array will be serialized, and will appear in ActionScript as an
Array object.
In other cases, the array will be serialized as a Hashtable, and in ActionScript it will be represented as an
Object, with properties named as the keys of the array.
The result sets from a query execution can be returned from a PHP service by passing them to a
CabronRecordSet instance.
new CabronRecordSet($result,"MYSQL");
Currently only the
MySQL result sets are handled, but in five minutes you can write your transformer function for any type of database using the provided sample code in the
gateway/lib/CabronRecordSet.php file.