add_item(label:String [, icon:String])
adds a new root item to TRENT. See below for the built-in icons
this method returns a pointer to the newly created trent item
highlight_color:Number
get or set the highlight color of the component
TRENT_ITEM reference
TRENT_ITEM is the class of the tree items. Whenever you use add_item on the component, a new instance of the TREE_ITEM class is created. This object has some features itself:
add_item(label:String [,icon:String])
see below for the collection of built-in icons
set_action(thisObject:Object, function:Function, arg1, ... , argN)
define which function should be called when the user clicks on the item. thisObject is the Object that can be access from within the function using the 'this' Keyword. Please note that function is of type Function (not String)
text_format:TextFormat
get or set the item's text format
label:String
get or set the item's text
bold:Boolean
get or set whether the label is bold
highlight_color:Number
set the highlight color of the item
Built-In Icons
TRENT has seven built-in
icons:
trent_folder_draft
trent_folder_trash
trent_folder_sent
trent_folder_spam
trent_folder_outbox
trent_folder_inbox
trent_folder_default (which is used when you do not supply an
icon)
Notes
TRENT has some 'hidden' features:
a double click opens or closes an item
the mousewheel is enabled
unlike Macromedia's tree component the scrollbar disappears when
there's no overlapping
Please download the evaluation version which adds a stamp above the
component, but is fully featured else.
only US$ 20.00
Code Example
This code builds a simplified tree structure as the example above:
/* a function to call */
/**********************/
function test(a, b)
{
trace("a = " + a);
trace("b = " + b);
trace(this);
}
/**********************/
/* add the root items and save the pointers */
var trent_trash:MovieClip = t.add_item("Deleted Items", "trent_folder_trash");
var trent_outbox:MovieClip = t.add_item("Outbox", "trent_folder_outbox");
var trent_inbox:MovieClip = t.add_item("Inbox", "trent_folder_inbox");
/* add some sub-items to the inbox item */
var trent_item0:MovieClip = trent_inbox.add_item("item 0");
var trent_item1:MovieClip = trent_inbox.add_item("item 1");
/* add more sub-items to one of the items above */
var trent_entry0:MovieClip = trent_item1.add_item("entry 0");
trent_item1.add_item("entry 1");
trent_item1.add_item("entry 2");
/* and again */
trent_entry0.add_item("folder a");
trent_entry0.add_item("folder b");
/* call the function 'test' from some of the items,
but use different attributes */
trent_trash.set_action(this, test, "a", "hi");
trent_outbox.set_action(this, test, "b", "from");
trent_inbox.set_action(this, test, "c", "trent");
Gianni Frey is a ColdFusion, C#, and Flash Programmer, and a Layout Designer. He currently studies Computer Science at ETH Zurich.