【发布时间】:2011-07-14 09:57:25
【问题描述】:
我在 Flash Builder 中有以下两个例程:
public function getData():void {
httpService = new HTTPService();
httpService.url = "https://mongolab.com/api/1/databases/xxx/collections/system.users/?apiKey=xxx";
httpService.resultFormat = HTTPService.RESULT_FORMAT_TEXT;
httpService.addEventListener(ResultEvent.RESULT, resultHandler);
httpService.send();
}
public function resultHandler(event:ResultEvent):void {
var rawData:String = String(event.result);
var arr:Array = JSON.decode(rawData) as Array;
Debug.log(rawData);
Debug.log(arr);
httpService.removeEventListener(ResultEvent.RESULT, resultHandler);
}
rawData 显示为 JSON 数据,但 arr 显示为 [object Object] 而不是数组。
我做错了什么?
【问题讨论】:
标签: json actionscript flexbuilder flash-builder