To use a well-formed string to create XML in Flash while authoring:
In Flash, select File > New and select Flash Document.
1.
Drag an instance of the Tree component onto the Stage.
2.
Select the Tree instance. In the Property inspector, enter the instance name myTree.
3.
In the Actions panel on Frame 1, enter the following code:
4.
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
.
myTree
Select Control > Test Movie.
5.
In the SWF file, you can see the XML structure displayed in the tree. Click items in the tree to
see the
trace()
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
UIObject.setSize()
is clipped.
Using styles with the Tree component
A Tree component uses the following styles:
Style
themeColor
backgroundColor
backgroundDisabledColor
depthColors
766
Chapter 6: Components Dictionary
myTreeDP
statements in the
change
). When a tree isn't wide enough to display the text of the nodes, the text
Theme Description
Halo
The base color scheme of a component. Possible values are
"haloGreen"
value is
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
Both
The background color when the component's
property is set to
(medium gray).
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.
and assigns it to the
event handler send the data values to the Output
method (see
setSize()
,
, and
"haloBlue"
.
"haloGreen"
alternatingRowColors
. The default value is 0xDDDDDD
"false"
property of
dataProvider
. The default
"haloOrange"
is specified.
enabled
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