Fill XML data into Tree and get it back when selected
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:XML format="e4x" id="myMenuModel"> <menu value="Menu"> <items value="A" data="0"> <item value="A1" data="1"/> <item value="A2" data="2" /> <item value="A3" data="3" /> </items> <items value="B" data="4"> <item value="B1" data="5"/> <item value="B2" data="6" /> <item value="B3" data="7" /> </items> <item value="C" data="8" /> <item value="D" data="9" /> <item value="E" data="10" /> </menu> </mx:XML> <mx:TextArea id="myText" text="{myTree.selectedItem.@value.toString()} : {myTree.selectedItem.@data.toString()}" height="49"/> <mx:Tree dataProvider="{myMenuModel}" labelField="@value" width="248" height="260" id="myTree"/> </mx:Application>