Hi Y’all…
I am working on a fancy tree component (rather simple)…It contains catagories, and within each catagory are company names…I want the categories to expand when you click on the category, and close if it’s open (this part works fine)…but I would like a specific action to occur when onRollOver occurs on a category…and a different onRollOver action to happen when you mouse over a company name in one of the categories…
For now…when you mouse over a category, I want to trace “category” and “company” when you mouse over a company name…if the categories are all closed, obviously no company traces should occur…I cannot get the node from the mouse over…it seems that the item has to be selected…am I wrong?
function loadTreeXML(url:String)
{
var treeXML:XML = new XML();
var menuTree:Tree;
treeXML.ignoreWhite = true;
treeXML.load(url);
treeXML.onLoad = function()
{
onMenuLoaded();
}
function treeChange(event:Object)
{
if (listAccChild3.menuTree == event.target)
{
var node = listAccChild3.menuTree.selectedNode;
trace(node);
if (listAccChild3.menuTree.getIsBranch(node))
{
listAccChild3.menuTree.setIsOpen(node, !listAccChild3.menuTree.getIsOpen(node), true);
}
var arr:Array = node.attributes.data.split(",");
if (arr)
{
if(showLoad && !boxOpen)
{
var shp:XMLShape = new XMLShape;
removePrevTarget(numTargets);
shp.listClick(arr);
listArr[lCc] = arr;
if(listArr[lCc] != listArr[lCc - 1])
{
shp.listChange(listArr[lCc-1]);
}
lCc++;
boothLight = true;
}
}
listAccChild3.menuTree.selectedNode = null;
}
}
function treeRollOver(event:Object)
{
if (listAccChild3.menuTree == event.target)
{
var node = listAccChild3.menuTree.selectedNode;
trace(node);
if (listAccChild3.menuTree.getIsBranch(node))
{
trace("category");
}
var arr:Array = node.attributes.data.split(",");
if (arr)
{
trace("company");
}
listAccChild3.menuTree.selectedNode = null;
}
}
function onMenuLoaded()
{
listAccChild3.menuTree.dataProvider = treeXML.firstChild;
listAccChild3.menuTree.addEventListener("change", treeChange);
listAccChild3.menuTree.addEventListener("itemRollOver", treeRollOver);
// listAccChild3.menuTree.addEventListener("itemRollOut", treeRollOut);
}
}
I know that I am nesting functions and that is not good practice, but that is not causing my problem so I want to focus on that…