Yes, if selectedIDs is a big array, it could take a while to do run the loop. You could try building up a hash table of ids
Var hashIDs:Object = new Object; For (var i:int = 0; I < N; i++) hashIDs[selectedIds[i].toString()) = 1; Then query once: var nodes:XMLList = xml.descendants().(hashIDs[@id] == 1) Then copy all the nodes into the final array.. That is more looping, but fewer XML queries and XML queries is usually way slower. Your mileage may vary. -Alex On 8/5/11 10:09 PM, "steveroger_flex" <steveroger_f...@yahoo.com> wrote: Thank you Alex. Its really great help. I have do one change. I used "var node:XML = xml.descendants().(@id == id)[0];" in place of "var node:XML = xml..node(@id == id)[0];" multiple selection is working perfectly. But will this change affect to my application performance? Steve. --- In flexcoders@yahoogroups.com, Alex Harui <aharui@...> wrote: > > SelectedItems must be an array. > > If you have: > > Var xml:XML = <node name="Node 1" id="1"> > <node name="Node 1.1" id="2" /> > <node name="Node 1.2" id="3"> > <node name="Node 1.2.1" id="4" /> > <node name="Node 1.2.2" id="5" /> > </node> > </node> > Var selectedIds:Array = [2, 4, 5]; > > Then you need something like: > > Var selItems:Array = new Array(); > For (var i:int = 0; I < n; i+++ > { ! > var id:String = selectedIds[i].toString(); > var node:XML = xml..node(@id == id)[0]; > selItems.push(node); > } > > Then assign selItems to the selectedItems. > > > On 8/5/11 1:12 AM, "steveroger_flex" steveroger_flex@... wrote: > > > > > > > Thanks alex for reply.. > but actually I do not getting how it implemented. > > Can you please provide me any similar kind of example? > Is it possible using XMLList? > > Steve > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , > Alex Harui aharui@ wrote: > > > > You will have to make a new array of the nodes you want selected. > > > > > > On 8/4/11 9:45 PM, "steveroger_flex" steveroger_flex@ wrote: > > > > > > > > > > > > > > I am hav! ing list of nodes in array. > > My problem is how sho! uld I us e seletedItems with list of node id array.? > > > > Data provider of tree component. > > > > <node name="Node 1" id="1"> > > <node name="Node 1.1" id="2" /> > > <node name="Node 1.2" id="3"> > > <node name="Node 1.2.1" id="4" /> > > <node name="Node 1.2.2" id="5" /> > > </node> > > </node> > > > > Node id Array=(2,4,5). > > I wanna select Node 1.1, Node 1.2.1 & Node 1.2.2 by clicking on button. > > > > tree.selectedItems = array; > > is not working. > > > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > > <mailto:flexcoders%40yahoogroups.com> , Alex Harui <aharui@> wrote: > > > > > > Use selectedItems > > > > > > > > > On 8/4/11 5:08 AM, "steveroger_flex" <stever! oger_flex@> wrote: > > > > > > > > > > > > > > > > > > > > > Hello Friends, > > > > > > I am facing a problem and can't getting any idea to solve this. > > > Problem is, I wanna select one or more tree nodes using actionscript. > > > I have set allowMultipleSelection="true" property of tree component. > > > > > > I succeed in selecting one node. But can't in multiple. > > > I had used tree.selectedItem for single node. > > > > > > any idea to solve this? > > > > > > Thanks, > > > > > > Steve. > > > > > > > > > > > > > > > > > > > > > -- > > > Alex Harui > > > Flex SDK Team > > > Adobe System, Inc. > > > ht! tp://blogs.adobe.com/aharui > > > > > ! > > ; > > > > > > > > > > -- > > Alex Harui > > Flex SDK Team > > Adobe System, Inc. > > http://blogs.adobe.com/aharui > > > > > > > > > -- > Alex Harui > Flex SDK Team > Adobe System, Inc. > http://blogs.adobe.com/aharui > -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui