Im loading the xml in, and Im able to read the xml nodes into text fields in my flash. It is also loading the url, but the last one from the loop. Its not loading the one that I click on. I tried using event.target, but that is not working. Im pretty close to figuring it out, Im just not sure where to look. Any help would be greatly appreciative!
// loads xml var xml:XML = new XML(); var loader:URLLoader = new URLLoader(); loader.load(new URLRequest(audioPlaylist)); loader.addEventListener(Event.COMPLETE, onComplete);
function onComplete(evt:Event):void { xml = XML(evt.target.data); xmlList = xml.children(); trace(xmlList); trackLength = xmlList.children().children().length(); trace(trackLength);
for(var i:int = 0; i < trackLength; i++) {
trace(i);
var track:Playlist_item = new Playlist_item();
track.y = i * 28;
track.playlist_text.text = xmlList.children().track[i].toString();
trackURL = xmlList.children().track[i][email protected]();
trace(trackURL);
playlist_container.addChild(track);
track.buttonMode = true;
track.mouseChildren=false;
track.addEventListener(MouseEvent.MOUSE_OVER, onCarHover);
track.addEventListener(MouseEvent.MOUSE_OUT, onCarOut);
track.addEventListener(MouseEvent.CLICK, onClickLoadData);
}
}
function onCarHover(event:MouseEvent):void { event.target.gotoAndStop(6); }
function onCarOut(event:MouseEvent):void { event.target.gotoAndStop(10); }
function onClickLoadData(event:MouseEvent):void { ns.play(trackURL); }