Thanks, Tracy. Also came across this technique: http://codejockeyscorner.blogspot.com/2007/12/flex-xml-object-to-arraycollection.html
BTW, do you have a blog? Thanks. --- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > Please, do, the default resultFormat is evil ;) > > > > Here is a quick, untested start. > > _acPremiums = new ArrayCollection() > > var xmlResult:XML = XML(event.result); > > var xlPremiums:XMLList = xmlResult.premium; //or xmlResult.children(); > > var xmlPremium:XML > > var voNew:MyVO; > > for () var i:int=0;i<xlPremiums.length();i++) { > > xmlPremium = xlPremiums[i]; > > voNew = new MyVO; > > voNew.fill(xmlPremium); //assumes a fill method. You could also > simply assign the vo properties here > > _acPremiums.addItem(voNew); > > } > > > > Tracy > > > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of oneworld95 > Sent: Tuesday, October 28, 2008 2:55 PM > To: [email protected] > Subject: [flexcoders] Re: Read XML data in as ArrayCollection > > > > Hi, Tracy. Hadn't thought about that. I'll work on implementing your > suggestion. Thanks. > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> > , "Tracy Spratt" <tspratt@> wrote: > > > > That only works because the default resultFormat causes Flex to cnvert > > your xml into a nested structure of dynamic objects. One result of is > > is that child groups are converted to Array. > > > > > > > > I advise you do not do this. You lose the benefits of e4x expressions, > > and wind up with loosely typed objects everywhere. The conversion > > always happens, so you do not gain any performance. Also the > conversion > > modifies your data, turning strings into numbers where it can, and > stuff > > like that. > > > > > > > > You will be better served in the long run if you simply loop over the > > XMLList and assign the attribute or child values to an instance of a > > strongly typed value object. > > > > > > > > Tracy > > > > > > > > > > > > > > > > ________________________________ > > > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> > [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> > ] On > > Behalf Of oneworld95 > > Sent: Tuesday, October 28, 2008 2:19 PM > > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > > Subject: [flexcoders] Re: Read XML data in as ArrayCollection > > > > > > > > Never mind! Figured it out: > > > > arrCol = event.result.premiums.premium as ArrayCollection > > > > Also took off the resultFormat from the HTTPService call. > > > > --- In [email protected] > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > , "oneworld95" <oneworld95@> wrote: > > > > > > Hi. I've got a Flex app that receives XML (resultFormat = "e4x") > data > > > from a servlet in this format, > > > > > > <premiums> > > > <premium id="ABCDEF01" startcount="0" currentcount="0"> > > > <category>CD</category> > > > <description>The CD Description</description> > > > <image id="3095"> > > > <filename>ABCDEF01__1225202763673.jpg</filename> > > > </image> > > > </premium> > > > <premium id="DEFGH01" startcount="0" currentcount="0"> > > > <category>DVD</category> > > > <description>DVD Description</description> > > > <image id="3078"> > > > <filename>DEFGH01__1225132169948.jpg</filename> > > > </image> > > > </premium> > > > </premiums> > > > > > > I need to convert it to an ArrayCollection and then an array to > > > manipulate the results (using the slice method). Any solutions? > > Thanks. > > > > > >

