JSON数据未定义

时间:2014-04-10 10:58:57

标签: json actionscript-3 flash

我对JSON数据有点问题。

我可以追踪event.target.data。但是当我将它解析为数组时,我无法显示它,它只是显示为未定义。想知道发生了什么,谢谢你的时间

Send1 = new URLRequest("http://localhost/Accountinfo.php");
            Send1.method = URLRequestMethod.POST;
            ALoader1 = new URLLoader();
            ALoader1.dataFormat = URLLoaderDataFormat.TEXT;
            ALoader1.load(Send1);
            ALoader1.addEventListener(Event.COMPLETE,Sandler1);

      function Sandler1 (event:Event):void{

          var resultString2 :String = event.target.data;
// parse result string as json object and cast it to array

           var resultArray2  :Array  = JSON.parse( resultString2 ) as Array;

          trace(event.target.data);
          trace(resultArray2.username);

        }

谢谢你的时间!

JSON结果:

[{"id":"174","username":"yahoo","password":"241fe8af1e038118cd817048a65f803e","email":"yahoo","phone":"123","bed1":"tr","Zip1":"tr","rangelow1":"tr","rangehigh1":"tr","bed2":"fesff","Zip2":"sef","rangelow2":"sef","rangehigh2":"fse"}]
undefined

0 个答案:

没有答案