Flash MX Components: FTree Example with Custom Expanders
/* ===========
* Description
* ===========
* This uses the same code as described in FTree Loading
External XML, however
* the original draws the expanders (+ and - sign) using actionscript.
In this example
* movieclips with the linkage names "expander_closed" and "expander_open"
were
* introduced which hold custom graphics.
*
* To use those also the prototype.drawExpander function in the FTreeSelectableItemClass
* movieclip had to be changed to the code shown below.
*
* © Bernhard Gaul, 2003
* ===========
*/
FTreeSelectableItemClass.prototype.drawExpander
= function(parentClip, nodeObj, width, selected) {
var cn = parentClip;
var cw = 1;
if(!nodeObj.isOpen())
{
cn.attachMovie("expander_closed",
"ex",1);
} else {
cn.attachMovie("expander_open",
"ex",1);
}
var ex = cn["ex"];
var mx = Math.floor(cw/2)
+ 1;
var mid = Math.floor(mx/2);
ex._x = Math.floor(this.mx
- mid);
ex._y = Math.floor(this.my
- mid);
}