Key
Control
Shift
The Tree component can be used to represent hierarchical data such as e-mail client folders, file
browser panes, or category browsing systems for inventory. Most often, the data for a tree is
retrieved from a server in the form of XML, but it can also be well-formed XML that is created
while authoring in Director. The best way to create XML for the tree is to create a Lingo object
using the XML Parser Xtra or an XML object using the Flash Asset Xtra. After you create a Lingo
object that contains an XML data source (or load one from an external source) you assign it to
Alert.cancelLabel
Formatting XML for the Tree component
The Tree component is designed to display hierarchical data structures. XML is the data model
for the Tree component. 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 attribute is read-only; you cannot set it directly. To set it, call the
Tree.setIsBranch() method.
Nodes in the XML data source can have any name. Notice in the sample above that each node is
named with the generic name node. The tree reads through the XML and builds the display
hierarchy based on 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 a disclosure triangle 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; root nodes appear at the top level of the tree and have
no parent.
There are many ways to structure XML. The Tree component is not designed to use all types of
XML structures, so it's important to use XML that the Tree component can interpret. 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 allows the tree to know what it expects to render, and allows you to
loop through the hierarchy to compare data.
228
Chapter 9: Using Flash, Flash Components, and Other Interactive Media Types
Description
Allows multiple noncontiguous selections.
Allows multiple contiguous selections.
.
Need help?
Do you have a question about the DIRECTOR MX 2004-USING DIRECTOR and is the answer not in the manual?
Questions and answers