Re: [flexcoders] Re: Error #1034: Type Coercion failed: cannot convert JSON Data
You can use code like this // Update the waiting window status splashWindow.msgForUser ="Perparing Wixi Desktop Folder Structure ..."; // taking the evet's current targate tempURLLoader = URLLoader(event.currentTarget); // taking dataString = String(tempURLLoader.data); dataFromWixi = JSON.decode(dataString); dataFromWixi = Object(dataFromWixi); wixiFoldersXMLString = new String(); if ( dataFromWixi ) { //wixiFoldersXMLString = DestinationNode.getParentXML(dataFromWixi[0].name.toString(),dataFromWixi[0].URL.toString()); wixiFoldersXMLString = DestinationNode.getParentXML("Desktop",dataFromWixi[0].URL.toString()); if ( dataFromWixi[0].children ) { prepareSubfoldersWixiStructure(dataFromWixi[0].children); } wixiFoldersXMLString = wixiFoldersXMLString + DestinationNode.getParentXMLEnd(); } tempByteArray = new ByteArray(); tempByteArray.writeUTF(wixiFoldersXMLString); tempByteArray.position = 0; wixiFoldersXMLString = tempByteArray.readUTF(); Best, Ashish On Wed, Mar 4, 2009 at 11:38 AM, Tracy Spratt wrote: >Then if you trace the length of rawArray, what do you get? > > > > I do not know JSON, but there are techniques to figure out exactly where a > problem lies. > > > > > > Tracy > -- > > *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On > Behalf Of *Keisha Lexie > *Sent:* Tuesday, March 03, 2009 11:08 PM > *To:* flexcoders@yahoogroups.com > *Subject:* Re: [flexcoders] Re: Error #1034: Type Coercion failed: cannot > convert JSON Data > > > > Yes, I have it like this: > > private function updatedPHPDataResult(event:ResultEvent):void > { >lblStatus.text = String(event.result); > } > > --Keisha > > > ------ > > *From:* Tracy Spratt > *To:* flexcoders@yahoogroups.com > *Sent:* Tuesday, March 3, 2009 5:33:05 PM > *Subject:* RE: [flexcoders] Re: Error #1034: Type Coercion failed: cannot > convert JSON Data > > Is your data in event.result? > > Tracy > -- > > *From:* flexcod...@yahoogro ups.com [mailto:flexcoders@ yahoogroups. com] > *On Behalf Of *keishalexie > *Sent:* Tuesday, March 03, 2009 5:29 PM > *To:* flexcod...@yahoogro ups.com > *Subject:* [flexcoders] Re: Error #1034: Type Coercion failed: cannot > convert JSON Data > > > > Here's where it is trying to decode from the project I have > > private function getPHPData(event: ResultEvent) :void > { > var rawArray:Array; > var rawData:String = String(event. result); > rawArray = JSON.decode( rawData) as Array; > dataArray = new ArrayCollection( rawArray) ; > } > > It's like it is just blocked and the information that is in the tables > from mysql cannot get processed into my flex data tables properly. > > --- In flexcod...@yahoogro ups.com , Anggie > Bratadinata > wrote: > > > > Have you decoded the JSON data ? > > > > Here's a snippet from a project I'm working on: > > > > public function resultHandler( e:ResultEvent) :void{ > > var rawString:String = String(e.result) ; > > var json:* = JSON.decode( rawString) ; > > var players:Array = json as Array; > > _model.leaders = new ArrayCollection( players); > > } > > > > I use the AC as a dataProvider for some list component. > > > > hth, > > -- > > Anggie Bratadinata | www.masputih. com | Indonesia > > > > On Tue, Mar 3, 2009 at 7:58 PM, keishalexie wrote: > > > > > Hi Everyone, > > > > > > I am fairly new to Flex and am doing a project using Flex 3, the > > > as3corelib, and a PHP file that is sending json data. The json data > > > is not being displayed in my data table and what is coming through is > > > valid (I checked in the JSON Validator). I really am not sure where > > > the problem is: the mxml, php, as3corelib, or what? Any suggestions > > > and I will post code if need be. > > > > > > > > > > > > >
RE: [flexcoders] Re: Error #1034: Type Coercion failed: cannot convert JSON Data
Then if you trace the length of rawArray, what do you get? I do not know JSON, but there are techniques to figure out exactly where a problem lies. Tracy _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Keisha Lexie Sent: Tuesday, March 03, 2009 11:08 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Error #1034: Type Coercion failed: cannot convert JSON Data Yes, I have it like this: private function updatedPHPDataResult(event:ResultEvent):void { lblStatus.text = String(event.result); } --Keisha _ From: Tracy Spratt To: flexcoders@yahoogroups.com Sent: Tuesday, March 3, 2009 5:33:05 PM Subject: RE: [flexcoders] Re: Error #1034: Type Coercion failed: cannot convert JSON Data Is your data in event.result? Tracy _ From: flexcod...@yahoogro ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf Of keishalexie Sent: Tuesday, March 03, 2009 5:29 PM To: flexcod...@yahoogro ups.com Subject: [flexcoders] Re: Error #1034: Type Coercion failed: cannot convert JSON Data Here's where it is trying to decode from the project I have private function getPHPData(event: ResultEvent) :void { var rawArray:Array; var rawData:String = String(event. result); rawArray = JSON.decode( rawData) as Array; dataArray = new ArrayCollection( rawArray) ; } It's like it is just blocked and the information that is in the tables from mysql cannot get processed into my flex data tables properly. --- In flexcod...@yahoogro ups.com <mailto:flexcoders%40yahoogroups.com> , Anggie Bratadinata wrote: > > Have you decoded the JSON data ? > > Here's a snippet from a project I'm working on: > > public function resultHandler( e:ResultEvent) :void{ > var rawString:String = String(e.result) ; > var json:* = JSON.decode( rawString) ; > var players:Array = json as Array; > _model.leaders = new ArrayCollection( players); > } > > I use the AC as a dataProvider for some list component. > > hth, > -- > Anggie Bratadinata | www.masputih. com | Indonesia > > On Tue, Mar 3, 2009 at 7:58 PM, keishalexie wrote: > > > Hi Everyone, > > > > I am fairly new to Flex and am doing a project using Flex 3, the > > as3corelib, and a PHP file that is sending json data. The json data > > is not being displayed in my data table and what is coming through is > > valid (I checked in the JSON Validator). I really am not sure where > > the problem is: the mxml, php, as3corelib, or what? Any suggestions > > and I will post code if need be. > > > > >
Re: [flexcoders] Re: Error #1034: Type Coercion failed: cannot convert JSON Data
Yes, I have it like this: private function updatedPHPDataResult(event:ResultEvent):void { lblStatus.text = String(event.result); } --Keisha From: Tracy Spratt To: flexcoders@yahoogroups.com Sent: Tuesday, March 3, 2009 5:33:05 PM Subject: RE: [flexcoders] Re: Error #1034: Type Coercion failed: cannot convert JSON Data Is your data in event.result? Tracy From:flexcod...@yahoogro ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf Of keishalexie Sent: Tuesday, March 03, 2009 5:29 PM To: flexcod...@yahoogro ups.com Subject: [flexcoders] Re: Error #1034: Type Coercion failed: cannot convert JSON Data Here's where it is trying to decode from the project I have private function getPHPData(event: ResultEvent) :void { var rawArray:Array; var rawData:String = String(event. result); rawArray = JSON.decode( rawData) as Array; dataArray = new ArrayCollection( rawArray) ; } It's like it is just blocked and the information that is in the tables from mysql cannot get processed into my flex data tables properly. --- In flexcod...@yahoogro ups.com, Anggie Bratadinata wrote: > > Have you decoded the JSON data ? > > Here's a snippet from a project I'm working on: > > public function resultHandler( e:ResultEvent) :void{ > var rawString:String = String(e.result) ; > var json:* = JSON.decode( rawString) ; > var players:Array = json as Array; > _model.leaders = new ArrayCollection( players); > } > > I use the AC as a dataProvider for some list component. > > hth, > -- > Anggie Bratadinata | www.masputih. com | Indonesia > > On Tue, Mar 3, 2009 at 7:58 PM, keishalexie wrote: > > > Hi Everyone, > > > > I am fairly new to Flex and am doing a project using Flex 3, the > > as3corelib, and a PHP file that is sending json data. The json data > > is not being displayed in my data table and what is coming through is > > valid (I checked in the JSON Validator). I really am not sure where > > the problem is: the mxml, php, as3corelib, or what? Any suggestions > > and I will post code if need be. > > > > >
RE: [flexcoders] Re: Error #1034: Type Coercion failed: cannot convert JSON Data
Is your data in event.result? Tracy _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of keishalexie Sent: Tuesday, March 03, 2009 5:29 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Error #1034: Type Coercion failed: cannot convert JSON Data Here's where it is trying to decode from the project I have private function getPHPData(event:ResultEvent):void { var rawArray:Array; var rawData:String = String(event.result); rawArray = JSON.decode(rawData) as Array; dataArray = new ArrayCollection(rawArray); } It's like it is just blocked and the information that is in the tables from mysql cannot get processed into my flex data tables properly. --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com, Anggie Bratadinata wrote: > > Have you decoded the JSON data ? > > Here's a snippet from a project I'm working on: > > public function resultHandler(e:ResultEvent):void{ > var rawString:String = String(e.result); > var json:* = JSON.decode(rawString); > var players:Array = json as Array; > _model.leaders = new ArrayCollection(players); > } > > I use the AC as a dataProvider for some list component. > > hth, > -- > Anggie Bratadinata | www.masputih.com | Indonesia > > On Tue, Mar 3, 2009 at 7:58 PM, keishalexie wrote: > > > Hi Everyone, > > > > I am fairly new to Flex and am doing a project using Flex 3, the > > as3corelib, and a PHP file that is sending json data. The json data > > is not being displayed in my data table and what is coming through is > > valid (I checked in the JSON Validator). I really am not sure where > > the problem is: the mxml, php, as3corelib, or what? Any suggestions > > and I will post code if need be. > > > > >
[flexcoders] Re: Error #1034: Type Coercion failed: cannot convert JSON Data
Here's where it is trying to decode from the project I have private function getPHPData(event:ResultEvent):void { var rawArray:Array; var rawData:String = String(event.result); rawArray = JSON.decode(rawData) as Array; dataArray = new ArrayCollection(rawArray); } It's like it is just blocked and the information that is in the tables from mysql cannot get processed into my flex data tables properly. --- In flexcoders@yahoogroups.com, Anggie Bratadinata wrote: > > Have you decoded the JSON data ? > > Here's a snippet from a project I'm working on: > > public function resultHandler(e:ResultEvent):void{ > var rawString:String = String(e.result); > var json:* = JSON.decode(rawString); > var players:Array = json as Array; > _model.leaders = new ArrayCollection(players); > } > > I use the AC as a dataProvider for some list component. > > hth, > -- > Anggie Bratadinata | www.masputih.com | Indonesia > > On Tue, Mar 3, 2009 at 7:58 PM, keishalexie wrote: > > > Hi Everyone, > > > > I am fairly new to Flex and am doing a project using Flex 3, the > > as3corelib, and a PHP file that is sending json data. The json data > > is not being displayed in my data table and what is coming through is > > valid (I checked in the JSON Validator). I really am not sure where > > the problem is: the mxml, php, as3corelib, or what? Any suggestions > > and I will post code if need be. > > > > >