将添加
corelib.swc
到您的库路径。导入JSON库:
import com.adobe.serialization.json.JSON;
使用如下代码调用服务:
var request:URLRequest=new URLRequest(); request.url=YOUR_ENDPOINT request.requestHeaders=[new URLRequestHeader("Content-Type", "application/json")]; request.method=URLRequestMethod.GET; var loader:URLLoader=new URLLoader(); loader.addEventListener(Event.COMPLETE, receive); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, notAllowed); loader.addEventListener(IOErrorEvent.IO_ERROR, notFound); loader.load(request); protected function receive(event:Event):void { var myResults:Array=JSON.depre(event.target.data); }- 用解析结果
JSON.depre(results)
。
在此处维护as3corelib:https :
//github.com/mikechambers/as3corelib#readme。



