You can use the labelFieldtree property to indicate which property you want to be the label for each node.
In your example, this will give you a sibling Tree:
<mx:Tree id="tree" dataProvider="{ac}" labelField="item" />
These links should help you:
: ArrayCollection , . Tree, , .
"", , "". ArrayCollection Object, , , . : , "".
:
{name: "Animals", children: new ArrayCollection([ {name: "Dog"}, {name: "Cat"} ])}
, :
:
|
| -
|
Dog
|
Dog Cat children, ArrayCollection. ?
, . "" , Tree. labelFunction , String , , , node .
ArrayCollection , Tree.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable] public var ac:ArrayCollection= new ArrayCollection([
{ name: "Animals", children: new ArrayCollection([ {name: "dog"}, {name: "cat"}])},
{ name: "Fruits", children: new ArrayCollection([ {name: "orange"}, {name: "apple"} ])}]);
]]>
</mx:Script>
<mx:Tree dataProvider="{ac}" labelField="name" />