tags:

views:

36

answers:

1

Hi my required tree structure is as follows

a  -- b -- d
   |  |
   |  |
   |  -- e
   -- c

I have my string array as follows

a/b,c b/d,e d/ e

where the component before / represents parent and the children of the corresponding parent are separated by ,

Can anyone provide me the logic to create a array collection for this hierarchy to set as dataprovider to my tree.

Thanks and regards

+1  A: 

Here's the general idea. (I'm not going to type all of the nodes out) Another approach is to create an object that has label and children properties rather than creating all of this dynamically with Objects. Hope that helps.

var dp:Array = new Array();

dp[0] = new Object();
dp[0].label = "a";
dp[0].children = new Array();
dp[0].children[0] = new Object();
dp[0].children[0].label = "b";

myTree.dataProvider = dp;
Wade Mueller