Not sure what you're really asking, how to do a nested tree? You need
to use XMLList instead of XML (I don't think it dynamically casts the
dataProvider to a XMLList if you provide it just XML).
You can swap out label with name and use the same labelField convention.
good luck,
- jon
Here's a tested example:
<mx:XMLList id="myTreeData">
<node label="Accounts">
<node label="First Account">
<node label="Inbox">
<node label="Flexcoders"/>
<node label="Flashcoders"/>
<node label="Flashnewbie"/>
</node>
<node label="Send Items">
<node label="Nested Tree e4x"/>
</node>
<node label="Trash">
<node label="Flashnewbie"/>
</node>
</node>
<node label="Second Account">
<node label="Inbox">
<node label="New Messages"/>
<node label="Flagged Items"/>
<node label="Attachments"/>
<node label="All Mail"/>
</node>
<node label="Send Items">
<node label="Tree Data Provider with e4x"/>
</node>
<node label="Trash">
<node label="Lame Yahoo HTML emails"/>
</node>
</node>
</node>
</mx:XMLList>
On May 18, 2007, at 11:12 AM, Richard Rodseth wrote:
I'm whipping up a mock-up of a UI much like a mail client (folder tree
+ data grid), using XML dummy data. I've got the rows of the data grid
populating with an e4x predicate, and I have the tree populating with
data like this:
<mx:Tree x="0" y="0" width="100%" height="100%"
dataProvider="{folders}" labelField="@name" showRoot="false"
defaultLeafIcon="@Embed(source='Assets.swf',
symbol='TreeFolderClosed')"></mx:Tree>
<mx:XML id="folders">
<folders>
<account name="account1">
<folder name="Inbox">
</folder>
<folder name="Sent Items">
</folder>
</account>
<account name="account2">
<folder name="Inbox">
</folder>
<folder name="Sent Items">
</folder>
</account>
</folders>