I worked on something similar not too long ago and my approach for #1 was to 
load top-level folders only and only drill inward with a server call as the 
user clicks on the expand arrow on individual folders. It made it appear more 
responsive for huge structures.

For #2 you can have each of your nodes be an object with a 'children' member 
that is an ArrayCollection of node objects. When inserting/removing you operate 
on the children ArrayCollection directly and the Tree will reflect the change 
on the next screen update.

var _children:ArrayCollection = new ArrayCollection();//add your child nodes to 
this

var _parent:Object = {label: 'parent', children: _children} //this would be the 
parent object

var _dp:ArrayCollection = new ArrayCollection([_parent]); //data provider for 
tree

- Ivo




________________________________
From: Dan Vega <danv...@gmail.com>
To: flexcoders@yahoogroups.com
Sent: Wednesday, December 17, 2008 6:01:36 AM
Subject: [flexcoders] File Explorer


I am building a full featured file explorer and I am stuck on one part of the 
application. On the left hand side I will have a base root directory (root) and 
a listing of all directories that fall under it (no end). When you click on a 
folder they will show up in the datagrid to the right. My question is actually 
2 parts.

1.) What approach should I take. Do I make one call to my server and build the 
entire folder structure, then return either and arraycollection or 
xmllistcollection or should I just grab the list of directories and show an 
arrow next to directories with sub directories indicating that there are sub 
directories. When you click on that folder make another call to the server to 
grab that sub directory list and so on.

2.) The second part of the question is i heard that If I am going to be 
updating this collection (deleting / adding / renaming directories) that I 
should be using an ArrayCollection. The question is when I have data like there 
is below, how do I break it down into parent/child nodes?  Every example I have 
seen of the tree always uses xml as the data and in those examples its clear 
how to break down child / parent relationships. 

** Any help on this how to move forward with this would be great help **

      [0] (Object)#3
        Attributes = ""
        DateLastModified = Sat Nov 1 13:21:02 GMT-0400 2008
        Directory = "H:\JRun4"
        hasDirs = 0
        Mode = ""
        Name = "bin"
        Path = "H:\JRun4\bin"
        Size = 0
        Type = "Dir"
      [1] (Object)#4
        Attributes = ""
        DateLastModified = Fri Aug 3 21:55:23 GMT-0400 2007
        Directory = "H:\JRun4"
        hasDirs = 1
        Mode = ""
        Name = "docs"
        Path = "H:\JRun4\docs"
        Size = 0
        Type = "Dir"


Thank You
Dan Vega
danv...@gmail. com
http://www.danvega. org
    

Reply via email to