User Guide
766 Chapter 6: Components Dictionary
To use a well-formed string to create XML in Flash while authoring:
1.
In Flash, select File > New and select Flash Document.
2.
Drag an instance of the Tree component onto the Stage.
3.
Select the Tree instance. In the Property inspector, enter the instance name myTree.
4.
In the Actions panel on Frame 1, enter the following code:
var myTreeDP:XML = new XML("<node label='Local Folders'><node label='Inbox'
data='0'/><node label='Outbox' data='1'/></node>");
myTree.dataProvider = myTreeDP;
This code creates the XML object myTreeDP and assigns it to the dataProvider property of
myTree.
5.
Select Control > Test Movie.
In the SWF file, you can see the XML structure displayed in the tree. Click items in the tree to
see the
trace() statements in the change event handler send the data values to the Output
panel.
Customizing the Tree component (Flash Professional only)
You can transform a Tree component horizontally and vertically while authoring and at runtime.
While authoring, select the component on the Stage and use the Free Transform tool or any of the
Modify > Transform commands. At runtime, use the
setSize() method (see
UIObject.setSize()). When a tree isn’t wide enough to display the text of the nodes, the text
is clipped.
Using styles with the Tree component
A Tree component uses the following styles:
Style Theme Description
themeColor
Halo The base color scheme of a component. Possible values are
"haloGreen", "haloBlue", and "haloOrange". The default
value is
"haloGreen".
backgroundColor
Both The background color of the list. The default color is white
and is defined on the class style declaration. This style is
ignored if
alternatingRowColors is specified.
backgroundDisabledColor
Both The background color when the component’s enabled
property is set to
"false". The default value is 0xDDDDDD
(medium gray).
depthColors
Both Sets the background colors for rows based on the depth of
each node. The value is an array of colors where the first
element is the background color for the root node, the
second element is the background color for its children, and
so on, continuing through the number of colors provided in
the array. This style property is not set by default.