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" <[EMAIL PROTECTED]> 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 >

