MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 1276

Components language reference
Table of Contents

Advertisement

This code creates an XML object called
a Tree component automatically receives all the properties and methods of the
TreeDataProvider interface. The second line of code creates a single root node called Local
Folders. For detailed information about the rest of the code, see the comments (lines
preceded with
//
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()
Output panel.
To use the ActionScript XML class to create XML:
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:
// Create an XML object.
var myTreeDP:XML = new XML();
// Create node values.
var myNode0:XMLNode = myTreeDP.createElement("node");
myNode0.attributes.label = "Local Folders";
myNode0.attributes.data = 0;
var myNode1:XMLNode = myTreeDP.createElement("node");
myNode1.attributes.label = "Inbox";
myNode1.attributes.data = 1;
var myNode2:XMLNode = myTreeDP.createElement("node");
myNode2.attributes.label = "Outbox";
myNode2.attributes.data = 2;
var myNode3:XMLNode = myTreeDP.createElement("node");
myNode3.attributes.label = "Sent Items";
myNode3.attributes.data = 3;
var myNode4:XMLNode = myTreeDP.createElement("node");
myNode4.attributes.label = "Deleted Items";
myNode4.attributes.data = 4;
// Assign nodes to the hierarchy in the XML tree.
myTreeDP.appendChild(myNode0);
myTreeDP.firstChild.appendChild(myNode1);
myTreeDP.firstChild.appendChild(myNode2);
myTreeDP.firstChild.appendChild(myNode3);
myTreeDP.firstChild.appendChild(myNode4);
// Assign the myTreeDP data source to the Tree component.
myTree.dataProvider = myTreeDP;
For more information about the XML object, see its entry in ActionScript 2.0 Language
Reference.
1272
Tree component (Flash Professional only)
) throughout the code.
statements in the
. Any XML object on the same frame as
myTreeDP
event handler send the data values to the
change

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents