That looks ok.
Did the trace show what you expect? If you think so, then move in on the data you want one step at a time: var xmlTemp:XML = xmlResult.projects; trace(xmlTemp.toXMLString()); //does this show the products node? var xlProjects:XMLList = xmlTemp.project; trace(xlProjects.length); //is this the expected number? //finally projectHolder = new XMLListCollection(xlProjects); trace(projectHolder.length); Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Sent: Friday, September 28, 2007 2:36 PM To: [email protected] Subject: [flexcoders] Re: I really need some help on how to display details of a record -arrayCollection I've actually never used XMLListCollection so I'm giving it a shot. It seems to be giving me some problems. I'm returning a length of 0. Is this correct or did I miss something. All the examples in the Help show it as MXML not ActionScript. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " layout="absolute" creationComplete="myXML.send()"> <mx:Script> <![CDATA[ import mx.collections.XMLListCollection; import mx.rpc.events.ResultEvent; // [Bindable] public var projectHolder:XMLListCollection; // public function extractProjects (event:ResultEvent):void { var xmlResult:XML = XML(event.result); trace(xmlResult.toXMLString()); projectHolder = new XMLListCollection (xmlResult.projects.project); trace(projectHolder.length); } ]]> </mx:Script> <mx:HTTPService id="myXML" url="http://getProjectXML.asp <http://getProjectXML.asp> " resultFormat="xml" result="extractProjects(event)"/> </mx:Application> --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > Oops yeah I misread that conditional + loop code. > > > > But you ARE mangling your xml. The default resultFormat of HTTPService > is "object", which causes flex to convert your xml into a nested object > structure. Such a structure is hard to debug and is less flexible than > xml. > > > > I advise using resultFormat="xml". Type projectArray as > XMLListCollection. Then in the result handler do: > > var xmlResult:XML = XML(event.result); > > trace(xmlResult.toXMLString()); //to verify your structure > > projectArray = new XMLListCOllection(xmlResult.projects.project); > > trace(projectArray.length); //to verify your list > > > > Now, the dg.selectedItem will hold a <project> node. > > > > You could bind directly to the selectedItem, but for easier > troubleshooting, I would declare a var(XMLList) to hold the detail > dataProvider(s), and assign them in a change handler of the dg: > > var xmlItem:XML = XML(event.target.selectedItem); > > trace(xmlItem.toXMLString()); //to verify your item structure > > _xlResources = xmlItem.resources.item > > > > Bind the repeater to _xlResources. > > > > Tracy > >

