我如何从php发送数组到as3并显示为列表

I am building an air app in flash cs6 using as3. My database is on a web server and I use php to connect to my app, I need to send an array from php to as3 and populate it in a list in my app, I just need to know how to send and receive an array so I can print it in my app thanks

Use JSON

on the AS3 side you can find docs here

on the php side use json_encode and json_decode

Try this:

Actionscript 3

import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;

var urlLoader:URLLoader=new URLLoader();
urlLoader.load(new URLRequest("http://example.com/json.php"));
urlLoader.addEventListener(Event.COMPLETE, urlLoaderCompleteHandler);

function urlLoaderCompleteHandler(e:Event):void {
    var json:Object=JSON.parse(urlLoader.data);
}

Now within urlLoaderCompleteHandler you can handle json as an object.

PHP

<?php
    $data=array("test"=>"Hello World!");
    header('Content-type: application/json');
    echo json_encode($data);
?>