Build a tree out of an XML document : Tree Data « Components « Flex






Build a tree out of an XML document

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>

   
    
    
    
    
    
  








Related examples in the same category

1.XML data for Tree viewXML data for Tree view
2.Reference XML attribute for tree dataReference XML attribute for tree data
3.Set dataProvider for Tree control through xml attributeSet dataProvider for Tree control through xml attribute
4.Using XML data models and use it as data for Tree controlUsing XML data models and use it as data for Tree control
5.Tree data is from XMLListCollectionTree data is from XMLListCollection
6.Use ActionScript to set up the data provider for Tree controlUse ActionScript to set up the data provider for Tree control
7.Fill XML data into Tree and get it back when selectedFill XML data into Tree and get it back when selected
8.AdvancedDataGrid with Grouping(A tree table).AdvancedDataGrid with Grouping(A tree table).
9.Tree uses an XMLListCollection object as the data source:Tree uses an XMLListCollection object as the data source:
10.Tree with static dataTree with static data
11.Hierarchical AdvancedDataGrid Tree Column(TreeTable)Hierarchical AdvancedDataGrid Tree Column(TreeTable)
12.Use an XML object and Tree controlUse an XML object and Tree control
13.Tree control and XMLListCollectionTree control and XMLListCollection
14.Build Tree from XMLListCollection
15.Search Tree node is to search XML with XPathSearch Tree node is to search XML with XPath
16.Tree controls uses an XML object directlyTree controls uses an XML object directly
17.Create Tree object from XMLListCreate Tree object from XMLList
18.Tree with static valueTree with static value