If you have used windows explorer you will know what a tree list looks like.
Okay I will show you how to use a tree component and how to pupulate data in it.
First we will open notepad and we will create a xml file. If you dont know what XML is please check on the internet about what is it all about.
Okay after you open notepad put the below text in it and save it as pics.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<Pics label = "Gallery images" src="mainimages">
<node label = "Gallery Pics" src="images/a.jpg">
<node label = "Picture 1" src="images/1.jpg" description="Picture of a baby in Afganistan"/>
<node label = "Picture 2" src="images/2.jpg" description="Children at a medical camp"/>
<node label = "Picture 3" src="images/3.jpg" description="Children at a medical camp"/>
<node label = "Picture 4" src="images/4.jpg" description="Children at a medical camp"/>
<node label = "Picture 5" src="images/5.jpg" description="Children at a medical camp"/>
<node label = "Picture 6" src="images/6.jpg" description="Children at a medical camp"/>
<node label = "Picture 7" src="images/7.jpg" description="Living water well in a village"/>
<node label = "Picture 8" src="images/8.jpg" description="Children going to the vidya jyothi program"/>
<node label = "Picture 9" src="images/9.jpg" description="Children at a medical camp"/>
<node label = "Picture 10" src="images/10.jpg" description="Children at a medical camp"/>
<node label = "Picture 11" src="images/11.jpg" description="Children at a medical camp"/>
<node label = "Picture 12" src="images/12.jpg" description="Children at a medical camp"/>
<node label = "Picture 13" src="images/13.jpg" description="Lambadas near a medical camp"/>
<node label = "Picture 14" src="images/14.jpg" description="Children at a medical camp"/>
<node label = "Picture 15" src="images/15.jpg" description="A small girl undergoing a check up"/>
<node label = "Picture 16" src="images/16.jpg" description="Children at a medical camp"/>
</node>
</Pics>
Now create a new document in Flash and then click and drag the tree component from the component panel.
Give the tree component an instance name of tree_control.
In the first frame of the movie give action
myTreeDataProvider = new XML();
// ignore whitespace in XML (important)
myTreeDataProvider.ignoreWhite = true;
// load external XML file
myTreeDataProvider.load("pics.xml");
// onLoad handler for XML data
myTreeDataProvider.onLoad = function()
{ tree_control.dataProvider = myTreeDataProvider;
}
The first line of the code creates a new XML object.
The second line sets ingnore white space of XML to true.
The third line actually loads the XML file pics.xml
The fourth line a function which checks if the XMl file is loaded If It is loaded it sets the dataProvider of the tree control to the XML object. The tree control takes care of populating the list.