Tree component
Today, I've started to work in a new project where I need to use the new UI components
So, to test myself, I've made the little links thing that you can see on the right.
And I must say that everything has been fast and easy!:
_global.style.setStyle("fontSize", 12);
myTree.setStyle("color", 0x999966);
myTree.setStyle("borderStyle","solid");
myTree.setStyle("themeColor", "haloBlue");
// load and asign content
myTreeDataProvider = new XML();
myTreeDataProvider.ignoreWhite = true;
myTreeDataProvider.onLoad = function(){
myTree.dataProvider = myTreeDataProvider;
}
myTreeDataProvider.load("/enlaces/tree_en.xml");
myTreeListener = new Object();
myTreeListener.tree = myTree;
myTreeListener.change = function(eventObject){
var theSelectedNode = eventObject.target.selectedNode;
var theSelectedNodeLabel = theSelectedNode.attributes.label;
var esLink = theSelectedNode.attributes.isLink;
var esBranch = this.tree.getIsBranch(theSelectedNode)
if (esBranch){
if (this.tree.getIsOpen(theSelectedNode)){
this.tree.setIsOpen(theSelectedNode, false, true);
}else{
this.tree.setIsOpen(theSelectedNode, true, true);
}
}else{
if (esLink){
var theSelectedNodeURL = theSelectedNode.attributes.url;
//trace("url " + theSelectedNodeURL);
getURL(theSelectedNodeURL, "_blank");
}
}
}
myTree.addEventListener("change", myTreeListener);
stop();
The spanish version works also with the same swf.
Obviously the xml is generated as utf-8, so flash can display spanish and english characters.
Comentarios
In early December I created a link tree with the Flash MX 2004 Tree component, and posted some example code - http://www.darronschall.com/weblog/archives/000075.cfm
In my example, I do the XML parsing by hand (since the menu is actually 5 different XML files). Also, take note of the "iconFunction" to allow for an image to be displayed for the category. I also went the old-school way of the "changeHandler" instead of defining a chance event listener.
To see the menu, you'll have to visit the front page of my weblog at http://www.darronschall.com/weblog/index.cfm
Publicado por: darron | January 12, 2004 03:03 AM
Hi, Darron, and welcome!
I remember reading about your link tree when you released it. It is great!
Publicado por: Cesar Tardaguila | January 12, 2004 09:20 AM