all groups > flash data integration > january 2006 >
You're in the

flash data integration

group:

XML / Tree / Utterly Lost!


XML / Tree / Utterly Lost! Capoeirista23
1/15/2006 10:24:11 PM
flash data integration: Hi There -

Trying to make a menu that loads topics from an xml file and then sends the
movie to a frame label when a node is selected. I'd like to have the frame
label be part of the xml file - an attribute, maybe?

Have been able to successfully load XML into a tree component via the xml
connector component.

Have been able to style it using the setStyle method.

Have not been able to grok how to get it to do anything when you select a node.

I sort of get that you need to add an change listener, but I'd like it to get
an attribute, set it as a variable and then use that variable to go to the
frame in the timeline.

I'm not married to the tree component. I'm happy to generate this menu
dynamically using an xml file any way that works.

Thanks,

Lee

Re: XML / Tree / Utterly Lost! Jim Foy
1/24/2006 12:00:00 AM
Hey dude,

It sounds like you have a pretty good idea of what's going on with the tree
component so i'll make this easy. I was a little confused at first too. Here
it is:

//Create a listener for the change
var cl:Object = new Object();

//Create what the listener will do
//To access a different attribute, just change "data" to whatever you want to
access.
cl.change = function(evt:Object):Void {
trace(evt.target.selectedNode.attributes.data);
}

//Add the listener to the tree called "myTree"
myTree.addEventListener("change", cl);

This should trace out whatever attribute you have typed in the change
listener. Of course, if you wanted to assign it to a variable, just create one
and assign the "evt.target.selectedNode.attributes.data" to it. Enjoy..
Re: XML / Tree / Utterly Lost! Jim Foy
1/24/2006 12:00:00 AM
Hey dude,

It sounds like you have a pretty good idea of what's going on with the tree
component so i'll make this easy. I was a little confused at first too. This
should trace out whatever attribute you have typed in the change listener. Of
course, if you wanted to assign it to a variable, just create one and assign
the "evt.target.selectedNode.attributes.data" to it. Enjoy..

//Create a listener for the change
var cl:Object = new Object();

//Create what the listener will do
//To access a different attribute, just change "data" to whatever you want to
access.
cl.change = function(evt:Object):Void {
trace(evt.target.selectedNode.attributes.data);
}

//Add the listener to the tree called "myTree"
myTree.addEventListener("change", cl);
AddThis Social Bookmark Button