views:

53

answers:

2

Hey, all. I am building an application in Flex Builder 3. Yes, I know that it has an auto-magic feature to build datasheet, but that will not work. I see many Flex controls, such as combo box, can take an array as a data source.

My question, therefore, is (1) How do I send the request from my action script to my PHP form to request a record set. (2) Presuming that my dataset is in a PHP assoc array, how do I format it to send it back to Action Script. (3) How do I take the data received from the recordset, and put it inot an actionscript array, suitable for use as a data source.

I can connect to my database in PHP, and query it just fine, so I don't need help with that. For consistency, and humor, lets presume that I have the following data in an assoc array that I pulled from a database.

Array ( [0] => Array ( [name] => Kirk [shirt] => Gold [assign] => Bridge )

[1] => Array ( [name] => McCoy [shirt] => Blue [assign] => Sick Bay )

[2] => Array ( [name] => Scotty [shirt] => Red [assign] => Engineering )

[3] => Array ( [name] => Spock [shirt] => Blue [assign] => Bridge )

[4] => Array ( [name] => Uhura [shirt] => Red [assign] => Bridge )

[5] => 1 )

A: 

I find it easier to send a request that retrieves the data from the PHP in XML format. Then inside the Flex application, turn it into an ArrayList and use it with your controls.

Jage
OK, how do I do that without any external libraries?
Adobe has a pretty good example using the HTTPService component in Flex with PHP example code included:http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_2.html
Jage
My boss did not want to add any new libraries. So this was the best way. You are right, the example is pretty good. thank you.