The XML returned by http://localhost:3000/simulations/4/resources.xml is:
<?xml version="1.0" encoding="UTF-8" ?> - <resources type="array"> - <resource> <capacity type="integer">1</capacity> <created_at type="datetime">2008-08-21T17:22:46Z</created_at> <desc>The grocery store server</desc> <id type="integer">2</id> <name>Rclerk</name> <simulation_id type="integer">4</simulation_id> <time_units>sec</time_units> <updated_at type="datetime">2008-08-21T17:22:46Z</updated_at> </resource> </resources> This is the same data returned by event.result in the event handler. LG --- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote: > > In the XML, not the MXML. Your snippet just started with <resources> > Usually, there's more before that. > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of weezee49 > Sent: Thursday, August 21, 2008 5:56 AM > To: [email protected] > Subject: [flexcoders] Re: TypeError: Error #1034: Type Coercion failed: > cannot convert ... > > > > I have 2 namespaces: > > <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> " > xmlns:wsm="com.websim.components.*" > > ... > > LG > > --- In [email protected] <mailto:flexcoders% 40yahoogroups.com> > , "Alex Harui" <aharui@> wrote: > > > > Any namespaces defined in the XML? > > > > > > > > ________________________________ > > > > From: [email protected] <mailto:flexcoders% 40yahoogroups.com> > > [mailto:[email protected] <mailto:flexcoders% 40yahoogroups.com> > ] On > > Behalf Of weezee49 > > Sent: Wednesday, August 20, 2008 5:16 PM > > To: [email protected] <mailto:flexcoders% 40yahoogroups.com> > > Subject: [flexcoders] TypeError: Error #1034: Type Coercion failed: > > cannot convert ... > > > > > > > > I'm getting the dreaded Type Coercion error on this line: > > > > resourcesAC = event.result.resources.resource; > > > > resourcesAC is declared as follows: > > > > [Bindable] > > private var resourcesAC : ArrayCollection = new ArrayCollection (); > > > > My result handler for my HTTPService is: > > > > private function handleRscListResult(event:ResultEvent):void{ > > resourcesAC = event.result.resources.resource; > > var rscObj:Object = new Object(); > > rscObj.name = "--New Resource--"; > > rscObj.resourceID = 0; > > resourcesAC.addItemAt(rscObj, 0); > > rscBox.rscListCB.selectedIndex=0; > > } > > > > Turns out that event.result.resources.resource is empty, which is > > why I'm getting the error. However, I can't figure out why this is > > empty. Here's my event.result: > > > > <resources type="array"> > > <resource> > > <capacity type="integer">1</capacity> > > <created_at type="datetime" nil="true"/> > > <desc>The grocery store server</desc> > > <id type="integer">2</id> > > <name>Rclerk</name> > > <simulation_id type="integer">4</simulation_id> > > <time_units>sec</time_units> > > <updated_at type="datetime" nil="true"/> > > </resource> > > </resources> > > > > When I check the length of event.result.resources.resource using > > trace(event.result.resources.resource.length()), I get 0. > > > > Why is this? Seems to me it should be 1 - there's one <resource> > > object in there! > > > > The only other guess I have is that somehow "resources" > > and "resource" are magic words. I was checking my routes.rb file > > today and noticed the following route: > > > > map.resources :resources > > > > which struck me as looking peculiar today. > > > > Has anyone run across this before? > > > > Thanks, > > LG > > >

