The Tree component comprises two sets of APIs: the Tree class and the TreeDataProvider
interface. The Tree class contains the visual configuration methods and properties. The
TreeDataProvider interface lets you construct XML and add it to multiple tree instances. A
TreeDataProvider object broadcasts changes to any trees that use it. In addition, any XML or
XMLNode object that exists on the same frame as a tree or a menu is automatically given the
TreeDataProvider methods and properties. For more information, see
interface (Flash Professional only)" on page
Formatting XML for the Tree component
The Tree component is designed to display hierarchical data structures using XML as the data
model. It is important to understand the relationship of the XML data source to the Tree
component.
Consider the following XML data source sample:
<node>
<node label="Mail">
<node label="INBOX"/>
<node label="Personal Folder">
<node label="Business" isBranch="true" />
<node label="Demo" isBranch="true" />
<node label="Personal" isBranch="true" />
<node label="Saved Mail" isBranch="true" />
<node label="bar" isBranch="true" />
</node>
<node label="Sent" isBranch="true" />
<node label="Trash"/>
</node>
</node>
Note: The
isBranch
Nodes in the XML data source can have any name. Notice in the previous example that each node
is named with the generic name
hierarchy according to the nested relationship of the nodes.
Each XML node can be displayed as one of two types in the tree: branch or leaf. Branch nodes can
contain multiple child nodes and appear as a folder icon with an expander arrow that allows users
to open and close the folder. Leaf nodes appear as a file icon and cannot contain child nodes. Both
leaves and branches can be roots; a root node appears at the top level of the tree and has no
parent. The icons are customizable; for more information, see
component" on page
There are many ways to structure XML, but the Tree component cannot use all types of XML
structures. Do not nest node attributes in a child node; each node should contain all its necessary
attributes. Also, the attributes of each node should be consistent to be useful. For example, to
describe a mailbox structure with a Tree component, use the same attributes on each node
(message, data, time, attachments, and so on). This lets the tree know what it expects to render,
and lets you loop through the hierarchy to compare data.
760
Chapter 6: Components Dictionary
attribute is read-only; you cannot set it directly. To set it, call
. The tree reads through the XML and builds the display
node
769.
787.
"Using skins with the Tree
"TreeDataProvider
Tree.setIsBranch()
.
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?
Questions and answers