i want to use a class as dataprovider for my <mx:Tree> control. First of all i tried the simple Adobe Tree Demo (Creating a Tree control) - it works. After this i put the Node Data into a Class like this:
package
{
import mx.collections.XMLListCollection;
public class ProjectTree extends XMLListCollection
{
public function ProjectTree()
{
var list:XMLList;
list = new XMLList
(
<folder label="Mail">
<folder label="INBOX"/>
<folder label="Personal Folder">
<Pfolder label="Business" />
<Pfolder label="Demo" />
<Pfolder label="Personal" isBranch="true" />
<Pfolder label="Saved Mail" />
</folder>
<folder label="Sent" />
<folder label="Trash" />
</folder>
);
this.source = list;
}
}
}
Tree definition:
<mx:Tree id="tree" showRoot="true" dataProvider="{projectTree}" creationComplete="getTree()"/>
Declaration:
<fx:Declarations>
<fx:Object id="projectTree"/>
</fx:Declarations>
Function:
protected function getTree():*
{
projectTree = new ProjectTree();
}
First: i get no errors or warnings and the browser starts fine and show the tree.
The Problem is, that the Tree goes "crazy" and didn't show the nodes correctly - all nodes texts is shown at root node.
If i open the node, the other nodes show also the full text of the nodes or have no text.
any idea???
thx4hlp