You would use the dataDescriptor to getChildren() and walk those
children collections as well.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of TJ Downes
Sent: Thursday, October 18, 2007 11:42 PM
To: [email protected]
Subject: [flexcoders] Re: how do I know which object I need to expand?

 

Thanks Alex

Maybe I'm misunderstanding. I would not how to get to the top level
objects, but what about the sub-level objects? Say I dont know how
many levels the collection is nested?

Let's say this is my function:

private function expandTree(event:CollectionEvent):void {
if(event.kind == CollectionEventKind.REFRESH) {
var parentItems:XMLList = sessionsByDateTree.dataProvider.children();

doExpand(parentItems);

function doExpand(items:XMLList):void {
var len:int = items.length();

// loop through collection backwards
for (var i:int = len-1; i >= 0; i--) {
var childList:XMLList = items[i].children();

//sessionsByDateTree.expandChildrenOf(*what object am i
passing in?*, true);

//if this node has children, let's recurse!
if (childList.length() > 0) {
doExpand(childList);
}
}
}
}

as you can see, my recursor is completely ignorant of what level it is
currently in. Will I need to track that?

 

Reply via email to