The way I have handled it is by getting a reference to the children array and
update the array with the retrieved data, somethin akin to:
private function listDirectories( event:ResultEven t):void {
var _node:Object = event.currentTarget;
_node.children = event.result as Array;
}
- Ivo
________________________________
From: Dan Vega <[email protected]>
To: [email protected]
Sent: Friday, December 19, 2008 10:28:29 PM
Subject: Re: [flexcoders] Tree problems
I am not sure what you mean by getChildren( ) though, when a branch is clicked
this method is called.
private function onItemOpen(event: TreeEvent) :void {
var path:String = event.item.path;
FileManager. getDirectories( path);
}
The getDirectories( ) method of the remote object call has a result handler
called listDirectories( ). So based on the path of the node that is clicked
(request for drill down) we make a remote call to get a list of directories for
that path. Im not sure between these 2 stpes how to add my new array of
directories to the empty children array of the node that was clicked.
private function listDirectories( event:ResultEven t):void {
var dirs:Array = event.result as Array;
// if the _directories array is null this is our root request
if(_directories == null) {
_directories = dirs;
}else {
//?????????
}
}
hope that makes a little more sense.