Tree control is using internally an
mx.controls.treeClasses.DefaultDataDescriptor object to get children for a node
etc., I advise you to look at its getChildren() method implementation (flex is
open source!). You'll need either to implement ITreeDataDescriptor interface or
extend DefaultDataDescriptor and override getChildren() only in case if you
have in the node a property for children other that 'children' (by default it
looks for the node's children in a 'children' property of your node). (Most
probably you'll have to implement ITreeDataDescriptor interface, again, look at
DefaultDataDescriptor implementation and decide how much code you can reuse
there, if not much or at all, consider a new implementation approach)
Suppose you have this folder implementation:
class Folder
{
public var label:String;
public var documents:ArrayCollection;
...
}
your getChildren() implementation we'll look something like this:
public function getChildren(node:Object, model:Object=null):ICollectionView
{
if (node is Folder)
{
return node.documents as ICollectionView;
}
...
}
good luck!