ahh, cool. thanks guys. On 6/9/07, bill_sahlas <[EMAIL PROTECTED]> wrote:
What if you were to create "ac" like this: var ac:ArrayCollection = new ArrayCollection(myXML.menu as Array); The way that I interpret the ArrayCollection (or XMLListCollection) source property rule is that you must use the methods to modify the "source" and don't rely on it's setter method (setting the property directly as in ac.source = myXML.menu as Array;). source property source:Array [read-write] The source of data in the ArrayCollection. The ArrayCollection object does not represent any changes that you make directly to the source array. Always use the ICollectionView or IList methods to modify the collection. Let me know if that works. --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, "dorkie dork from dorktown" <[EMAIL PROTECTED]> wrote: > > Since the ArrayCollection can only accept an Array I think my problem is how > to convert an XMLList from an XML object into an Array. > > On 6/8/07, dorkie dork from dorktown <[EMAIL PROTECTED]> > wrote: > > > > I cant successfully convert xml to a array collection. I don't know what > > I'm doing wrong. It works in MXML not AS3. > > > > Here is the result from a service call: > > > > public function resultHandler(event:ResultEvent):void { > > > > trace("result :" + event.result); > > var myXML:XML = XML(event.result); > > var ac:ArrayCollection = new ArrayCollection(); > > ac.source = myXML.menu as Array; > > ac.refresh(); > > trace(ac.length); > > linkBarNav.dataProvider = ac; > > > > } > > > > > > TypeError: Error #1034: Type Coercion failed: cannot convert > > [EMAIL PROTECTED] to Class. > > > > It works fine with this model : > > > > <mx:Model id="menuXML"> > > <mainmenu> > > <menu id="madmin" label="Maintenance" role="admin" > > roleAction="hide"> > > <submenu id="mudacControl" label="UDAC Controls" > > link="/das/admin/udacControlMaint.faces" role="base" roleAction="diable"/> > > <submenu id="mcmrlUsers" label="CMRL Users" > > link="/das/admin/cmrlUsersMaint.faces" role="base" roleAction="diable"/> > > <submenu id="mtemplates" label="Templates" > > link="/das/admin/templateMaint.faces" role="base" roleAction="diable"/> > > <submenu id="mquestions" label="Questions" > > link="/das/admin/questionMaint.faces" role="base" roleAction="diable"/> > > </menu> > > <menu id="mwork" label="Queues" role="base"> > > <submenu id="mworkQueue" label="Work Queue" > > link="/das/work/workQueue.faces" role="base" roleAction="diable"/> > > <submenu id="missuesQueue" label="Issues Queue" > > link="/das/work/issuesQueue.faces" role="base" roleAction="diable"/> > > <submenu id="mjbpmNodes" label="Nodes" > > link="/das/work/nodes.faces" role="base" roleAction="diable"/> > > </menu> > > <menu id="mhelp" label="Help" role="base"> > > <submenu id="mhelpDoc" label="Help Document" > > link="/somelink" role="base" roleAction="diable"/> > > </menu> > > </mainmenu> > > </mx:Model> > > > > <mx:ArrayCollection id="myAC" source="{menuXML.menu}" > > filterFunction="filterMenu"/> > > >