Hi everybody!
 
I need your help to cuztomize the Tree component...
I aim at expanding all nodes of my cuztomized tree when initializing it.
 
I created a CuztomizedTree class as following :
------------------------------------------------------------------------------------------------------------------------
import mx.controls.Tree;
import mx.controls.treeclasses.TreeNode;
import mx.controls.Alert;
 
class com.as.components.CustomizedTree extends Tree
 
function CustomizedTree()
 {
 }
 
 function setIsOpen( node, open, animate, fireEvent):Void
 {
    // actions dedicated to the SetIsOpen method
}
 
 public function expandTree()
 {
  var selectedNode:TreeNode=this.selectedNode;
  if (selectedNode && this.selectedIndex != 0)
  {
   var node:TreeNode=this.getNodeDisplayedAt(this.selectedIndex);
   this.setIsOpen(node,true); 
   setAdaptedIcon(this, selectedNode, selectedNode.attributes.operand);
  } else {
   var i:Number=0;
   var node:TreeNode=this.getTreeNodeAt(i);

   Alert.show("node.selectedIndex : " + node.attributes.label, "______Message__", Alert.OK);
    // this message generates the following message
    //
    // Error /WEB-INF/flex/user_classes/com/as/components/CustomizedTree.as:100
    // There is no property with the name 'selectedIndex'.
    //
    // Error
    // Unable to create ActionScript Component for com.as.components.CustomizedTree: Could not compile 'synthetic: Object.registerClass() for com.as.components.CustomizedTree'

   while (node != undefined)
   {
    if (this.getIsBranch(node) && ! this.getIsOpen(node))
    {
     this.setIsOpen(node,true);
    }
    setAdaptedIcon(this, node, node.attributes.operand);
    i++;
    node=this.getNodeDisplayedAt(i);
   }
  }
 }
---------------------------------------------------------------------------------------------------------------------------------
In my Tree.mxml file, I call this method in an initAppli method
 
 public function initTree()
 {
  tree.expandTree(); // tree is the name of my CuztomizedTree object
 }
------------------------------------------------------------------------------------------------------------------------------------
Any suggestions?
Thank a lot!
 
PS: Thanksfull thoughts to Gordon Smith, Tracy Spratt and Matt Chottin for their suggestions concerning the treenode adding and the tree collapsing!

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

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