How can you do that in one pass? I found the nodes by searching the descendants() result. I can find them by using the children call and traversing the tree, but then I have to back out to the top to open the nodes. This still means I'd have to traverse the tree for each item I find. The problem is I have 100+ items found by the search, so I have to traverse the tree that many times. The user wants to have each node found in the search displayed and displayed in red text and then be able to hit return to move from found item to found item.
--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > Do it the other way around. Find the nodes you want displayed, then use > xml.parent() to climb up the ancestor chain, expanding nodes as you go. > I have a simple example on www.cflex.net <http://www.cflex.net/> . > > > > Tracy > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of j_lentzz > Sent: Tuesday, February 12, 2008 4:28 PM > To: [email protected] > Subject: [flexcoders] How to expand nodes down in trees > > > > Hi, > > I have an app where I need open up the nodes of a tree to display a > node chosen through a search text. For example, if I type 'flex' in > the search box, I need to display all the nodes that have 'flex' in > their label. This means that I need to open all the parent nodes down > to that node. I'm using flex 2, so I can't use any new Flex 3 > methods. I have a routine that will recursively open up the parent > nodes from a given node, but it needs to start at the top of the tree > to work, so if many items are found it gets very slow. I'd like to do > it in a single pass. I can identify the nodes I want to display by > searching through the XMLList from calling > XMLListCollection(this.dataProvider).descendants(); Is there a way to > use this structure to determine the trail of nodes to open without > having to start at the top of the tree and recurse for each item? > > Thanks, > > John >

