This sounds like the old problem that the Player has about differentiating between an array with a single element and an object.  Perhaps the solution will be to use the toArray utility function.  Yoy might have to import it to use it but try:

 

source="{toArray(xmldata.song)}

 

Tracy


From: [email protected] [mailto:[email protected]] On Behalf Of Michael van Leest
Sent: Friday, July 07, 2006 2:02 PM
To: [email protected]
Subject: Re: [flexcoders] Re: Convert XML to Array(Collection)

 

I got it something like this:

<mx:Model id="xmldata" source="playlist.xml" />
<mx:ArrayCollection id="testAC" source="{xmldata.song}" />

<mx:DataGrid width="100%" dataProvider="{testAC}"
click="traceSome();">
<mx:columns>
<mx:DataGridColumn headerText="Artist" dataField="artist"/>
<mx:DataGridColumn headerText="Title" dataField="title"/>
<mx:DataGridColumn headerText="Genre" dataField="genre"/>
</mx:columns>
</mx:DataGrid>

But when I only have 1 song in my xml file, an error occurs. Any thoughts??

Thanks, Michael

Travis Young schreef:
>
> I am using this for populating a DataGrid from XML or a WebService.
> Seems to work with 1 or multiple record sets returned.
>
> [Bindable]
> public var myXMLList:XMLList;
>
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





YAHOO! GROUPS LINKS




__,_._,___

Reply via email to