公司要求使用JSON格式来获取服务器端的数据
通过谷歌大神帮助 成功解决了问题
无奈服务器端返回的JSON格式两边都有括号
费劲了几番周折 才搞定 不敢独享 发出来大家一起玩玩
import com.adobe.lib.JSON;
这个包是在官网上下的源代码 然后封包 包名称是自己起的
1. 首先使用HTTPService 对象获取数据
2. 然后使用JSON来解析获取的数据
3. 最后使用ArrayCollection 绑定到DataGrid上
发现数据有乱码 在Application 中加入属性 initialize="flash.system.System.useCodePage=true"
数据格式如下 带有括号 在程序中进行了简单的过滤 ({"id":"1","totalCount":"1","results": [{"timeEarlyWarning":"","linkTel":"138900900","dis patchSources":"group","no":"电路- 21111111- 009","statusStr":"","appUserInfo":"","checkTime":" ","serviceModeDetail":"0132" ,"drafPerson":"黄xx","appManager":"","specialtyCheckerId":"","alter Man":"","actualFeedBackTime" :"","toDeps":"省分公司","dispatchGroupId":"","appBusinessDep":"","circui tNum":"","signTime":"","di spatchZOBId":"","signOpinion":"","appTime":"","dea lStatus":"new","clientEmail" :"","createTime":"2011-03-01 11:49","serviceModeDetailStr":"国内DDN电路","locationId":"2","circuitAppType":"client"}]}) 程序代码如下 flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" initialize="flash.system.System.useCodePage=true" creationComplete="application1_creationCompleteHan dler(event)" > 0) { var results_array:Array = jsonObj.results as Array; arrColl = new ArrayCollection(results_array); } } protected function http_service_faultHandler(event:FaultEvent):void { trace("访问服务器失败"); } ]]--> width="761" height="159">
通过谷歌大神帮助 成功解决了问题
无奈服务器端返回的JSON格式两边都有括号
费劲了几番周折 才搞定 不敢独享 发出来大家一起玩玩
import com.adobe.lib.JSON;
这个包是在官网上下的源代码 然后封包 包名称是自己起的
1. 首先使用HTTPService 对象获取数据
2. 然后使用JSON来解析获取的数据
3. 最后使用ArrayCollection 绑定到DataGrid上
发现数据有乱码 在Application 中加入属性 initialize="flash.system.System.useCodePage=true"
数据格式如下 带有括号 在程序中进行了简单的过滤 ({"id":"1","totalCount":"1","results": [{"timeEarlyWarning":"","linkTel":"138900900","dis patchSources":"group","no":"电路- 21111111- 009","statusStr":"","appUserInfo":"","checkTime":" ","serviceModeDetail":"0132" ,"drafPerson":"黄xx","appManager":"","specialtyCheckerId":"","alter Man":"","actualFeedBackTime" :"","toDeps":"省分公司","dispatchGroupId":"","appBusinessDep":"","circui tNum":"","signTime":"","di spatchZOBId":"","signOpinion":"","appTime":"","dea lStatus":"new","clientEmail" :"","createTime":"2011-03-01 11:49","serviceModeDetailStr":"国内DDN电路","locationId":"2","circuitAppType":"client"}]}) 程序代码如下 flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" initialize="flash.system.System.useCodePage=true" creationComplete="application1_creationCompleteHan dler(event)" > 0) { var results_array:Array = jsonObj.results as Array; arrColl = new ArrayCollection(results_array); } } protected function http_service_faultHandler(event:FaultEvent):void { trace("访问服务器失败"); } ]]--> width="761" height="159">