Listener Objects and XML List Components

I was given some code here that allowed me to populate a list component with my XML.  That thread and code is here:

http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21314467.html

Now, I'm trying to understand how my listener can know how to associate the item that was clicked on in the list with a different item in my xml. Here is my listener object:

var nodes:Array = _root.songList.firstChild.childNodes;

for(var i:Number = 0; i < nodes.length; i++){
      var children:Array = nodes[i].childNodes;
      _root.song_list.addItem(children[0].firstChild.nodeValue, children);
}
      var listener:Object = new Object();
      listener.change = function(evt:Object):Void
{
      var data:Object = evt._root.song_list.selectedItem.data;
};
_root.song_list.addEventListener("change", listener);

It's watching change to the list componet with the instance name of song_list.  The code I have works, I'm just trying to understand it so I can implement it in a slightly different way elsewhere.  I need to understand how the listener know which node was selected so I can access other associated data for that node (if I'm saying that correctly).
LVL 1
Aspirin99Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BuffonCommented:
you get in you function as parameter "evt:Object", this event object contains properties (properties that contain information about the event) for example:
evt.target      <<----         a reference to the component instance broadcasting the event


so in this case, instead of:
evt._root.song_list.selectedItem.data
you can write:
evt.target.data


evt.target is a cell you update and it has properties like data and label.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aspirin99Author Commented:
I'm just not making the connection. I'll study some more and see if I can ask the question better.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.