hi,
hope this helps:
<mx:Tree id="treeSiteList" width="100%" height="78%"
dataProvider="{acSiteTreeList}" iconFunction="myTreeIcon"
itemOpen="setView(event)"/>
private function setView(event:TreeEvent):void {
if(event.item.type == "something" && event.item.fetch ==
false) {
myEvent = event; //(myEvent is of type TreeEvent)
//update the dataprovider
var obj:ObjectProxy;
var item:Object;
var children:ArrayCollection;
for(var i:int = 0; i < acSomething.length; i++) {
obj= new ObjectProxy();
obj["type"] = "something";
obj["children"] = new ArrayCollection();
obj["fetch"] = false;
item = myEvent.item;
children = item.children;
item.fetch = true;
children.addItem(obj);
acSiteTreeList.itemUpdated(item);
}
}
}
fetch is a property i have used in the dataprovider to tell me if I have
fetched the child nodes previously or not...
[Embed(source="../assets/someIcon.png")]
private var reqdIconClass:Class;
private function myTreeIcon(item:Object):Class {
if(item.type == "something") {
return reqdIconClass;
}else {
return null;
}
}
Regards,
Gautam.
On 3/31/07, Justin Makeig <[EMAIL PROTECTED]> wrote:
Does anyone know of a public Flex 2 implementation of a lazy-loaded tree
that I could
reference (e.g. loading children dynamically from the server upon
expanding a node)? From
my searching I've seen a lot of dead ends and frustration, but no solid
examples. I'd hate to
(clumsily) reinvent the wheel. Any help would be much appreciated.
Justin