Mega Code Archive

 
Categories / Flex / Components
 

Build a tree out of an XML document

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();" >     <mx:Script>              import mx.collections.*;         [Bindable]         public var folderList:XMLList =<>             <folder state="unchecked" label="Marketing Collateral" isBranch="true" >               <folder state="unchecked" isBranch="true" label="data" >                   <folder state="unchecked" isBranch="false" label="A" />                   <folder state="unchecked" isBranch="false" label="D" />               </folder>               <folder  state="unchecked" isBranch="true" label="data 2" >                   <folder state="unchecked" isBranch="false" label="Applications" />                   <folder state="unchecked" isBranch="false" label="Forms" />               </folder>             </folder>             </>;         [Bindable]         public var folderCollection:XMLListCollection;         private function init() : void{             folderCollection = new XMLListCollection(folderList);             checkTree.dataProvider = folderCollection;         }        </mx:Script>     <mx:Tree id="checkTree" labelField="@label" width="100%" height="100%"/> </mx:Application>