pseudo.Tree class
View Sample :: Return to index  
pseudo.Tree.Tree(pThis:MovieClip)
Tree constructor. You never use the constructor to create this component.

Parameters None
Returns Nothing
Example
    None


pseudo.Tree.create(pOwner:MovieClip, strName:String, n :Number):pseudo.Tree
Use this static function to create new Tree on the specified movie clip. Never use constructor directly to do it.

Parameters pOwner The movie clip on which the new Tree will be drawn.
strName The new Tree instance name.
nDepth The new Tree instance depth.
Returns The reference to the new Tree instance
Example
    //create instance of the Tree class
    var tree:pseudo.Tree = pseudo.Tree.create(_root, "tree", 1);
    tree.setSize(200, 350);
    
    //Apply the skin to the Tree
    
    tree.setLook(pseudo.look.XPLook.getInstance());
    
    //Set cell class that will be used to render the tree items.
    tree.setCellClass(classes.CellTree);
    
    //Add some data to combobox. Data objects in the array should have three necessary flags:
    // "text" this flag will be used to draw the item label , "cellType" to determine if the item is folder (1)or the leaf (0)
    //"depth" is used to set an offset of the item in the tree
    var arrData:Array = new Array();
    arrData.push({text:"root 1", cellType:1, depth:0});
    arrData.push({text:"leaf 1", cellType:0, depth:1});
    arrData.push({text:"leaf 2", cellType:0, depth:1});
    arrData.push({text:"folder", cellType:1, depth:1});
    arrData.push({text:"leaf 1", cellType:0, depth:2});
    arrData.push({text:"folder", cellType:1, depth:2});
    arrData.push({text:"folder", cellType:1, depth:3});
    arrData.push({text:"folder", cellType:1, depth:4});
    arrData.push({text:"folder", cellType:1, depth:4});
    arrData.push({text:"folder", cellType:1, depth:5});
    arrData.push({text:"leaf 2", cellType:0, depth:2});
    arrData.push({text:"leaf 3", cellType:0, depth:1});
    arrData.push({text:"root 2", cellType:1, depth:0});
    arrData.push({text:"leaf 1", cellType:0, depth:1});
    arrData.push({text:"root 3", cellType:1, depth:0});
    arrData.push({text:"leaf 1", cellType:0, depth:1});
    arrData.push({text:"leaf 1", cellType:0, depth:0});
    
    tree.setTreeData(arrData);
    
    //
    tree.expandAll();
    
    tree.setSelId(0);
    
    tree.update();
    tree.draw();
    
    // This code will draw the Tree element using XP look and feel skin.
    // Please notice that you should always use some skin to create the component, 
    // this can be done like in this example, and the skin will be compiled into the swf file,
    // or you can use another technique and load the skin at a run time.
           


pseudo.Tree.getTreeData():Array
Returns the reference to the data array associated with this Tree.

Parameters None
Returns Array value
Example
    None


pseudo.Tree.setTreeData(arrData:Array):Void
Function that sets the data associated with the tree. The data array that is the array of the objects. You can add more properties to these objects as many as you want but Data objects in the array should have three necessary flags:

   - "text" this flag will be used to draw the item label ,
   - "cellType" to determine if the item is folder (1)or the leaf (0)
   - "depth" is used to set an offset of the item in the tree

Parameters arrData Array value
Returns Nothing
Example
    See example for the create function
           


pseudo.Tree.showBranch(id:Number):Void
Displays the branch with the specified id.

Parameters id Number value
Returns Nothing
Example
    None


pseudo.Tree.hideBranch(id:Number):Void
Hides the branch with the specified id.

Parameters id Number value.
Returns Nothing
Example
    None


pseudo.Tree.getSelData():Object
Returns the selected item data object.

Parameters None
Returns Object
Example
    None


pseudo.Tree.setCellClass(pClass:Function):Void
Sets the cell class that will be used to render tree items. ????

Parameters pClass Function value
Returns Nothing
Example
    None


pseudo.Tree.collapseAll():Void
Collapses all items of the tree

Parameters None
Returns Nothing
Example
    None


pseudo.Tree.expandAll():Void
Expends all items of the tree.

Parameters None
Returns Nothing
Example
    None


pseudo.Tree.updateData(start:Number):Void
Updates data in the tree.

Parameters start Number value
Returns Nothing
Example
    None


pseudo.Tree.getTreeStruct(arrData:Array):Object
Returns internal virtual tree structure.

Parameters arrData Array value
Returns Object value
Example
    None


pseudo.Tree.updateTreeData():Void


Parameters None
Returns Object
Example
    None
Flash UI Components (c)TUFaT.com, All Rights Reserved.