"How to handle data that's returned when I'm not exactly sure who requested it"
Use the AsyncToken for this. Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Pat Buchanan Sent: Wednesday, April 25, 2007 2:26 PM To: [email protected] Subject: Re: [flexcoders] Lazy-loaded tree examples Gautam - works like a charm! Thank you very much for replying and helping out the community! -Pat On 4/24/07, Gautam < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Hi Pat, Sorry for the delay... I have attached a simple example for the tree behavior you are looking for. Go through the children property in the Tree component and the itemOpen event. That should help. Its similar to the previous code i had sent. Just that you will know exactly how it works now. Regards, Gautam. On 4/24/07, Pat Buchanan < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Gautam: Thanks for replying and sharing your knowledge. I understood most of what you shared, but I could never get my example working. Do you have a runnable example? Maybe one that just randomly generated children instead of having to go back to the database? Once I see how it works, I can add the call back to the database. Like Jim, that will be my next hill to conquer. How to handle data that's returned when I'm not exactly sure who requested it (if the user clicks on another item before data is returned) THANKS GAUTAM! On 17 Apr 2007 19:26:00 -0700, Gautam <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: 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] <mailto:[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

