Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-11-2005, 12:15 PM   #1
forgueam
Registered User
 
Join Date: Aug 2005
Location: Cincinnati, OH, USA
Posts: 14
Send a message via ICQ to forgueam Send a message via AIM to forgueam
Default Tree Component within Accordion Component

I have dragged an instance of the Accordion component onto my movie, now I would like to programmatically (i.e. with actionscript) create a Tree component inside of the Accordion sections. Below is the code I am using, but it doesn't seem to work. Any suggestions?

ActionScript Code:
CategoryHeader = Accordion.createChild("CategoryContainer", "CategoryHeader", {label: 'SomeName'}); CategoryMC = CategoryHeader.createEmptyMovieClip("CategoryMC", 10); var MyTree = CategoryMC.createClassObject(mx.controls.Tree,"MyTree",5); // 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;

Thanks in advance for any help!
Aaron
forgueam is offline   Reply With Quote
Old 06-08-2006, 06:01 PM   #2
davej
Senior Member
 
Join Date: Dec 2005
Posts: 263
Default any Luck

I am trying to do the same did you have any luck with this?
davej is offline   Reply With Quote
Old 06-15-2006, 02:04 AM   #3
JohnThomasCraig
Registered User
 
Join Date: Nov 2003
Posts: 9
Smile Check your syntax

I think your syntax for createChild is incorrect. Here's an example with nothing on the stage and a tree and an accordian in the library:

Code:
import mx.managers.DepthManager;
import mx.controls.Tree;
import mx.containers.Accordion;

var _folder_tree:Tree;
var _interface_acc:Accordion;

_interface_acc = this.createClassChildAtDepth(Accordion, DepthManager.kTop, {_name:"interface_acc"});
_interface_acc.setSize(Stage.width,Stage.height);
_folder_tree = Tree(_interface_acc.createChild(Tree,"folder_tree", {label:"All Documents"}));

_folder_tree.setDataProvider("<folder label=\"Stuff\"><file data=\"Stuff\" label=\"Stuff\" /><file data=\"Stuff\" label=\"Stuff\" /><file data=\"Stuff\" label=\"Stuff\" /><file data=\"Stuff\" label=\"Stuff\" /><file data=\"Stuff\" label=\"Stuff\" /></folder><folder label=\"Stuff\"><file data=\"Stuff\" label=\"Stuff\" /><file data=\"Stuff\" label=\"Stuff\" /></folder>");

stop();
JohnThomasCraig is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:11 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.