# Trace data from a list component

**URL:** <https://forum.kirupa.com/t/trace-data-from-a-list-component/244355>\
**Category:** flash\
**Created:** [November 16, 2007, 5:46pm UTC](https://forum.kirupa.com/t/trace-data-from-a-list-component/244355 "2007-11-16T17:46:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [November 16, 2007, 5:46pm UTC](https://forum.kirupa.com/t/trace-data-from-a-list-component/244355/1 "2007-11-16T17:46:15Z")

</div>

Well this is my first attempt at AS3 so here goes…Ive successfully loaded xml into a list component. I want to just trace out the data part of the slide list when you change the selection. I have MouseEvent.CLICK right now but its tracing out “[object Object]” even if I click the up or down arrows, so I am assuming there is some sort of Event that I dont know of that I am not using. Any ideas?

```auto

stop();
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, onLoadXML);
loader.load(new URLRequest("data.xml"));
function onLoadXML(ev:Event) {
    try {
        var myXML:XML = new XML(ev.target.data);
        var list:XMLList = myXML.Slide;
        for (var i=0; i<list.length(); i++) {
            var title = list*.Title;
            var bgSwf = list*.BGSwf;
            var swfFile = list*.SwfFile;
            var slideText = list*.SlideText;
            slideList.addItem({label:(i+1)+". "+title, data:i});
        }
    } catch (e:TypeError) {
        trace("Could not parse the XML");
        trace(e.message);
    }
}

slideList.addEventListener(MouseEvent.CLICK, showData);

function showData(e:Event) {
    trace(e.target.data);
}

```
