问题描述
- as3.0 json的问题,读取json
- package
{
import com.adobe.serialization.json.JSON;import flash.display.Sprite;import flash.events.Event;import flash.net.URLLoader;import flash.net.URLRequest;public class getJSON extends Sprite{ public function getJSON() { var urlLoader:URLLoader = new URLLoader(); urlLoader.load(new URLRequest(""json_example.txt"")); urlLoader.addEventListener(Event.COMPLETE decodeJSONHandler); } private function decodeJSONHandler(event:Event):void { var jsonArray:Array = com.adobe.serialization.json.JSON.decode(URLLoader(event.target).data); }}
}
其中的json_example.txt内容是:
[
{
href"":'http://detail.tmall.com/item.htm?spm=a1z10.5-b.w4011-3014592695.95.W4nwSY&id=18065707931&rn=7d6c58742cca3a35419929331ddf6476&abbucket=2'
imgurl"":'http://img.alicdn.com/bao/uploaded/i2/TB1XkkgFVXXXXcZaXXXXXXXXXXX_!!0-item_pic.jpg_430x430q90.jpg'
price"":'398.00'
name"":'水星家纺 纯棉四件套全棉床上用品简约床单被套特价 蓝语迷情'
id"":1}
]
com.adobe.serialization.json.JSON和as,swf在同一目录下,求高手帮忙指导一下我代码出了什么问题。
时间: 2024-10-02 12:50:11