Home arrow XML arrow Page 5 - The Flex Tree Control

The treeData Variable declaration and Calling the init function - XML

The Flex Tree control is amazingly useful when building applications, especially if you're dealing with hierarchical data. To learn how to add the power of this intuitive organizational component to your developer's toolbox, keep reading.

  1. The Flex Tree Control
  2. Updating the Code for the Tree Control
  3. From Leafs to Branches
  4. Part 2: A Tree with an Array Data Provider
  5. The treeData Variable declaration and Calling the init function
By: Keith Lee
Rating: starstarstarstarstar / 9
August 06, 2009

print this article



The treeData variable is declared with the following line:

The [Bindable] keyword tells the compiler that the treeData Array can bind to a control such as a data provider. So, if the Array is changed, the control will be updated automatically. In this article, we only scratch the surface in covering information on bindings and data providers. For more information see on data providers see Flex Quick Start: Building an advance user interface on adobe.com.  

To call our init function, we've added an attribute on the mx:Application tag. This attribute is "preinitialize." The value of he attribute is the name of our function 'init()'.  

Here is what the code looks like:


The preinitialize event is one of many events that are triggered when an application launches. In particular, I've selected preinitialize because it occurs before the control is added to the layout. In this way, I can be assured that the data provider is fully populated so that when the control is displayed, the data will be present.  

The result of changing XMLList out for a Array is the same. Using one over the other really depends on what the source of your data is and how it is organized. It is common for flex/flash apps to connect to web services to retrieve their data, and thankfully ActionScript is capable is using both of these types.

>>> More XML Articles          >>> More By Keith Lee

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Google Docs and Xpath Data Functions
- Flex Array Collection Sort and Filtering
- The Flex Tree Control
- Flex List Controls
- Working with Flex and Datagrids
- How to Set Up Podcasting and Vodcasting
- Creating an RSS Reader Application
- Building an RSS File
- An Introduction to XUL Part 6
- An Introduction to XUL Part 5
- An Introduction to XUL Part 4
- An Introduction to XUL Part 3
- An Introduction to XUL Part 2
- An Introduction to XUL Part 1
- XML Matters: Practical XML Data Design and M...

Developer Shed Affiliates


Dev Shed Tutorial Topics: