The TextField in the TreeCellRenderer is controlled by the textFormat style of the renderer itself.
Try adding the following line in the set listData function in TreeCellRenderer.as (make sure to add the path containing com/yahoo... to your classpath so that the modified TreeCellRenderer overrides the embedded code. Alternatively, you can create a new custom CellRenderer class and use that instead of the TreeCellRenderer):
ActionScript Code:
setStyle("textFormat", new TextFormat("Arial", 8 + 2*data.nodeLevel));
That would make the size of the font bigger the deeper the node is in the hierarchy ("data" is the pointer to the TNode object; it has a nodeLevel property).
You can also add a custom event listener for roll over and roll out to change the style of the text to bold. You don't even need to do that inside the TreeCellRenderer. Say your tree is called "mytree". Then, the following code will do it:
ActionScript Code:
import fl.events.ListEvent;
import com.yahoo.astra.fl.controls.treeClasses.*;
// Add listener functions for rolling over and out of tree items
mytree.addEventListener(ListEvent.ITEM_ROLL_OVER, rollOverItem);
mytree.addEventListener(ListEvent.ITEM_ROLL_OUT, rollOutItem);
function rollOverItem (evt:ListEvent) {
// Get the cell renderer for the item we just rolled over
var cr:TreeCellRenderer = mytree.itemToCellRenderer(evt.item) as TreeCellRenderer;
// Get the text format for that cell renderer
var tf:TextFormat = cr.getStyle("textFormat") as TextFormat;
// Set its bold value to true
tf.bold = true;
}
// Same thing as above but set bold to false
function rollOutItem (evt:ListEvent) {
var cr:TreeCellRenderer = mytree.itemToCellRenderer(evt.item) as TreeCellRenderer;
var tf:TextFormat = cr.getStyle("textFormat") as TextFormat;
tf.bold = false;
}
Best,
Allen