Why don’t you just use the parentNode.addTreeNode method?  You definitely don’t need to create your own TreeNode class to support this. 

 

var newNode = { operand: “+”, label: “LABEL”, type: “NODE” };

tree.selectedNode.getParent().addTreeNode(newNode);

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of david_gal-reyniez
Sent: Wednesday, June 15, 2005 8:25 AM
To: [email protected]
Subject: [flexcoders] TREE : TreeNode & TreeNode attributes creation

 

Hi everybody,

 

I need your help to create new attributes to a TreeNode.

I created a button which call the function addNodeUp()

Inside this function is the following code :

 

 

 public var newNode:TreeNode;
 public var selectedNode:TreeNode;

addNodeUp()

{

  var parentNode:TreeNode=tree.selectedNode.getParent();

  var childArr:Array = new Array();
  childArr = parentNode.getChildNodes();

 

  newNode =  new TreeNode("label", "data", parentNode);
  newNode.setProperty("data", "data", false);
  newNode.setProperty("operand", "OPERAND", false);
  newNode.setProperty("operator", "+", false);
  newNode.setProperty("label", "LABEL", false);
  newNode.setProperty("type", "NODE", false);
     
  childArr.unshift(newNode);

}

 

My problem is that I don't create the differents attributes for my new TreeNode except the label property and the data property which exist by default.

Should I have to create a cuztomized TreeNode Class implementing the existing one?

Have I done the right (best?) steps to create a node TreeNode into my Tree?

 

Thank for your help!

 

David

 

 

 

**********************************************************************

Coface facilite les echanges entre les entreprises partout dans le monde. Pour cela, elle offre a toutes les entreprises des solutions pour gerer, financer et proteger leur poste client, en leur permettant d'externaliser tout ou partie de la gestion et des risques lies a leurs relations commerciales. Coface est notee AA par Fitch Ratings et Aa3 par Moody's.

Pour en savoir plus, http://www.coface.fr

Coface facilitates business-to-business commerce worldwide. It offers all size companies an array of solutions to manage, finance, and protect their accounts receivables affording them the option of fully or partly outsourcing trade relationship management and attendant risks. Coface is rated AA by Fitch ratings and Aa3 by Moody's.

More about Coface, http://www.coface.com

WARNING :

- Soyez conscient que notre systeme Anti-Spam peut parfois rejeter des messages, soit parce que certains mots et types de fichiers ne sont pas acceptes, ou bien parce que le mail n'a pas ete identifie correctement.

- Be aware that from time to time our Anti-Spam system may reject mails either because some words and types of files are not allowed or because mails are misidentified.

**********************************************************************

 



Yahoo! Groups Links

Reply via email to