Tree control

353 views

Published on

Tree Control in Flex

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
353
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Tree control

  1. 1. Tree Control Hemakumar.S Open Source Developer
  2. 2. Creating a Tree control <ul><li>Define a Tree control in MXML by using the <mx:Tree> tag. </li></ul><ul><li>The Tree control normally gets its data from XML structure Array Collection or XMLListCollection. </li></ul>
  3. 3. DefaultDataDescriptor class <ul><li>Collections   </li></ul><ul><li>A collection implementation, such as an XMLListCollection or ArrayCollection object. The DefaultDataDescriptor class includes code to handle collections efficiently. Always use a collection as the data provider if the data in the menu changes dynamically; otherwise the Tree control might display obsolete data. </li></ul><ul><li>XML   </li></ul><ul><li>A string containing valid XML text, or any of the following objects containing valid E4X format XML data: <mx:XML> or <mx:XMLList> compile-time tag, or an XML or XMLList object. </li></ul><ul><li>Other objects  </li></ul><ul><li>An array of items, or an object that contains an array of items, where a node's children are contained in an item named children. </li></ul>
  4. 4. Sample Program <ul><li>The DefaultDataDescriptor class also supports using an <mx:Model> tag as a data provider for a menu, but all leaf nodes must have the name children; As a general rule, it is a better programming practice to use the <mx:XML> or <mx:XMLList> tags when you need a Tree data provider that uses binding. </li></ul><ul><li>Example: </li></ul><ul><li><?xml version=&quot;1.0&quot;?> </li></ul><ul><li><!-- dpcontrols/TreeSimple.mxml --> </li></ul><ul><li><mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;> </li></ul><ul><li><mx:Tree id=&quot;tree1&quot; labelField=&quot;@label&quot; showRoot=&quot;true&quot; width=&quot;160&quot;> </li></ul><ul><li><mx:XMLListCollection id=&quot;MailBox&quot;> </li></ul><ul><li><mx:XMLList> <folder label=&quot;Mail&quot;> </li></ul><ul><li><folder label=&quot;INBOX&quot;/> </li></ul><ul><li><folder label=&quot;Personal Folder&quot;> </li></ul>
  5. 5. Cont…. <ul><li><Pfolder label=&quot;Business&quot; /> </li></ul><ul><li><Pfolder label=&quot;Demo&quot; /> </li></ul><ul><li><Pfolder label=&quot;Personal&quot; isBranch=&quot;true&quot; /> </li></ul><ul><li><Pfolder label=&quot;Saved Mail&quot; /> </li></ul><ul><li></folder> <folder label=&quot;Sent&quot; /> </li></ul><ul><li><folder label=&quot;Trash&quot; /> </li></ul><ul><li></folder> </mx:XMLList> </li></ul><ul><li></mx:XMLListCollection> </li></ul><ul><li></mx:Tree> </li></ul><ul><li></mx:Application> </li></ul>
  6. 6. Screen Shot
  7. 7. Thank You

×