Main Page | Packages | Class Tree | Index | Help

com.bjc.controls

class Tree

MovieClip
  |
  +--com.bjc.core.BJCComponent
        |
        +--com.bjc.core.LabelWrapper
              |
              +--com.bjc.controls.Tree


class Tree
extends LabelWrapper

A tree component that displays an xml data provider. Each displayed node must have an attribute named "label".

Events:

change - Fired whenever the user changes the selected item of the component either by clicking a new item on the tree or using the cursor keys to move to a new item.
click - Fired whenever the user clicks on an item in the tree, changing the currently selected item.
scroll - Fired once each frame while tree is being scrolled.
focus - Fired whenever the component receives focus.
killFocus - Fired whenever the component loses focus.
tabFocus - Fired whenever the component receives focus by pressing the TAB key.


Author:
Flashloaded - www.flashloaded.com


Field Summary

public
addEventListener: Function
See the EventDispatcher Class in Flash Help

public
changeHandler: Function
Can be used to assign a direct event handler to the component instance.

public
clickHandler: Function
Can be used to assign a direct event handler to the component instance.

public
focusHandler: Function
Can be used to assign a direct event handler to the component instance.

public
killFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

public
removeEventListener: Function
See the EventDispatcher Class in Flash Help

public
scrollHandler: Function
Can be used to assign a direct event handler to the component instance.

public
tabFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Fields inherited from class com.bjc.core.BJCComponent

version

Property Summary

public
dataProvider: XMLNode (write)
Sets the data provider of the component (an xml object). Each node that is to be displayed should contain an attribute named "label". If that node contains child nodes, you can also include an attribute named "open" which can be set to true or false, and will determine if that folder on the tree is open or not.

public
dataProvider: XMLNode (read)
Gets the data provider of the component.

public
highlightColor: Number (write)
Sets the color to use when an item in the tree is rolled over.

public
highlightColor: Number (read)
Gets the color used when an item in the tree is rolled over.

public
indentSize: Number (write)
Sets the distance in pixels that each new level of the tree will be indented.

public
indentSize: Number (read)
Gets the distance in pixels that each new level of the tree will be indented.

public
rowHeight: Number (write)
Sets the height for the individual rows in the tree.

public
rowHeight: Number (read)
Gets the height of the individual rows in the tree.

public
scroll: Number (write)
Sets the current scroll value of the component.

public
scroll: Number (read)
Gets the current scroll value of the component.

public
scrollBarWidth: Number (write)
Sets the width of the scrollbar used in the tree (if needed)

public
scrollBarWidth: Number (read)
Gets the width of the scrollbar used in the tree

public
selectedColor: Number (write)
Sets the color to use when an item in the tree is clicked on.

public
selectedColor: Number (read)
Gets the color used when an item in the tree is clicked on.

public
selectedIndex: Number (write)
Sets the selected item.

public
selectedIndex: Number (read)
Gets the number of the currently selected item in the tree.

public
selectedNode: XMLNode (read-only)
A reference to the currently selected xml node in the tree.

Properties inherited from class com.bjc.core.LabelWrapper

align, disabledColor, disableStyles, embedFont, fontColor, fontFace, fontSize, html

Properties inherited from class com.bjc.core.BJCComponent

disabledAlpha, enabled, focusTime, height, keyEnabled, style, width

Constructor

public
Tree ( Void)


Method Summary

public static
create ( target: MovieClip, id: String, depth: Number, initObj: Object ): Tree
Static method used to create an instance of a Tree on stage at run time.

Methods inherited from class com.bjc.core.BJCComponent

draw, invalidate, move, remove, setSize



Field Documentation

addEventListener

public var addEventListener: Function
See the EventDispatcher Class in Flash Help

changeHandler

public var changeHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myTree.changeHandler = function(){
trace("I was changed.");
}

clickHandler

public var clickHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myTree.clickHandler = function(){
trace("I was clicked.");
}

focusHandler

public var focusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myTree.focusHandler = function(){
trace("Set focus.");
}

killFocusHandler

public var killFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myTree.killFocusHandler = function(){
trace("Kill focus.");
}

removeEventListener

public var removeEventListener: Function
See the EventDispatcher Class in Flash Help

scrollHandler

public var scrollHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myTree.scrollHandler = function(){
trace("Scrolling...");
}

tabFocusHandler

public var tabFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myTree.tabFocusHandler = function(){
trace("Tab focus.");
}


Property Documentation

dataProvider

public dataProvider: XMLNode (write)
Sets the data provider of the component (an xml object). Each node that is to be displayed should contain an attribute named "label". If that node contains child nodes, you can also include an attribute named "open" which can be set to true or false, and will determine if that folder on the tree is open or not.

Example:
myDP = new XML("<node label='Top' open='true'><subnode label='Some node'/></node>");
myTree.dataProvider = myDP;

dataProvider

public dataProvider: XMLNode (read)
Gets the data provider of the component.

Example:
myVar = myTree.dataProvider;

highlightColor

public highlightColor: Number (write)
Sets the color to use when an item in the tree is rolled over.

Example:
myTree.highlightColor = 0xcccccc;

highlightColor

public highlightColor: Number (read)
Gets the color used when an item in the tree is rolled over.

Example:
myVar = myTree.highlightColor;

indentSize

public indentSize: Number (write)
Sets the distance in pixels that each new level of the tree will be indented.

Example:
myTree.indent = 20;

indentSize

public indentSize: Number (read)
Gets the distance in pixels that each new level of the tree will be indented.

Example:
myVar = myTree.indent;

rowHeight

public rowHeight: Number (write)
Sets the height for the individual rows in the tree.

Example:
myTree.rowHeight = 25;

rowHeight

public rowHeight: Number (read)
Gets the height of the individual rows in the tree.

Example:
myVar = myTree.rowHeight;

scroll

public scroll: Number (write)
Sets the current scroll value of the component.

Example:
myTree.scroll = 10;

scroll

public scroll: Number (read)
Gets the current scroll value of the component.

Example:
myVar = myTree.scroll;

scrollBarWidth

public scrollBarWidth: Number (write)
Sets the width of the scrollbar used in the tree (if needed)

Example:
myTree.scrollBarWidth = 20;

scrollBarWidth

public scrollBarWidth: Number (read)
Gets the width of the scrollbar used in the tree

Example:
myVar = myTree.scrollBarWidth;

selectedColor

public selectedColor: Number (write)
Sets the color to use when an item in the tree is clicked on.

Example:
myTree.selectedColor = 0xaaaaaa;

selectedColor

public selectedColor: Number (read)
Gets the color used when an item in the tree is clicked on.

Example:
myVar = myTree.selectedColor;

selectedIndex

public selectedIndex: Number (write)
Sets the selected item.

Example:
myTree.selectedIndex = 5;

selectedIndex

public selectedIndex: Number (read)
Gets the number of the currently selected item in the tree.

Example:
myVar = myTree.selectedIndex;

selectedNode

public selectedNode: XMLNode (read-only)
A reference to the currently selected xml node in the tree.

Example:
trace(myTree.selectedNode.attributes.label);


Constructor Documentation

Tree

public function Tree(Void)

Method Documentation

create

public static function create(target: MovieClip,
 id: String,
 depth: Number,
 initObj: Object): Tree
Static method used to create an instance of a Tree on stage at run time.

Parameters:
target
the movie clip to which the tree will be attached.
id
the instance name given to the new tree attached.
depth
the depth at which to attach the new tree.
initObj
(optional) an object containing any properties you want to assign to the component when it is created
Returns:
a reference to the new tree attached.

Example:
import com.bjc.controls.Tree;
var newTree:Tree = Tree.create(_root, "myTree", 0);


The documentation was generated from the following file:


Copyright Flashloaded - www.flashloaded.com