# 911 Need To Help Loading Xml Mp3's

**URL:** <https://forum.kirupa.com/t/911-need-to-help-loading-xml-mp3s/264004>\
**Category:** flash\
**Created:** [June 21, 2008, 10:02pm UTC](https://forum.kirupa.com/t/911-need-to-help-loading-xml-mp3s/264004 "2008-06-21T22:02:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![antegrav08](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@antegrav08](https://forum.kirupa.com/u/antegrav08)\
**Post date:** [June 21, 2008, 10:02pm UTC](https://forum.kirupa.com/t/911-need-to-help-loading-xml-mp3s/264004/1 "2008-06-21T22:02:44Z")

</div>

Hello everyone, I really need help i need to put up site as soon as possible because the client need to have his site up by tomorrow Sunday. Everything is pretty much up but the section for the music is not loading the mp3’s to the player. They are supposed to be loading via xml. All the player reads right now is “undefined”. If i test it out on my computer from my desktop it works fine, all mp3’s load ok, but when i uploaded the site to the server and went live i get the undefined message. The site is “[corkranmedia.com](http://corkranmedia.com)” if anyone wants to visit the site.

I got the code from a tutorial online: This is the code  
/\*  
XML MP3 PLAYER BY ZAIN SYED  
NOV 2005  
If you have any problems/suggestions or feedback please contact me at [zain@flashmatics.co.uk](mailto:zain@flashmatics.co.uk)  
ENJOY!!!  
\*/

this.\_lockroot = true;

//make textfields autosize  
album\_txt.autoSize = “left”;  
artist\_txt.autoSize = “left”;  
title\_txt.autoSize = “left”;

//create sound object  
var songInterval:Number;  
var amountLoaded:Number;  
var mySound:Sound;  
var nextTrack:Number;

//this will contain all the track details from the xml file  
var tracks\_array:Array = new Array();  
var totalTracks:Number;

//create the XML object and populate with track details  
var jukebox\_xml:XML = new XML();  
jukebox\_xml.ignoreWhite = true;  
var RootNode:XMLNode;

jukebox\_xml.onLoad = function(success:Boolean) {  
if (success) {  
RootNode = this.firstChild;  
totalTracks = RootNode.childNodes.length;  
populateTracksArray();  
} else {  
trace(“error loading xml file”);  
}  
};  
jukebox\_xml.load(“electric.xml”);

function populateTracksArray():Void{  
for(var i:Number=0; i \< totalTracks;i++){  
tracks\_array\* = RootNode.childNodes\*;  
tracks\_array\*.source = RootNode.childNodes\*.attributes.source;  
tracks\_array\*.artist = RootNode.childNodes\*.attributes.artist;  
tracks\_array\*.album = RootNode.childNodes\*.attributes.album;  
tracks\_array\*.title = RootNode.childNodes\*.attributes.title;  
}  
//play first track

```
	playTrack(tracks_array[0].source,tracks_array[0].artist,tracks_array[0].album,tracks_array[0].title,true);
	
	//populate list component with song titles
	populateList();

```

}  
function playTrack(source, artist, album, title, stream):Void{  
artist\_txt.text = artist;  
album\_txt.text = album;  
title\_txt.text = title;  
mySound = new Sound();

```
	mySound.onSoundComplete = function():Void{
		//lets play the next song
if(continous_comp.selected){
		if(list_comp.selectedIndex &lt; (totalTracks -1)){
list_comp.selectedIndex +=1;
}else{
	list_comp.selectedIndex = 0;
}
playTrack(tracks_array[list_comp.selectedIndex].source,tracks_array[list_comp.selectedIndex].artist,tracks_array[list_comp.selectedIndex].album,tracks_array[list_comp.selectedIndex].title, true);
}
		}

	mySound.loadSound(source,stream);
	clearInterval(songInterval);
	songInterval = setInterval(songProgress,100);

```

}

function populateList():Void{  
for(var i:Number=0; i\<totalTracks;i++){  
list\_comp.addItem(tracks\_array\*.title,tracks\_array\*.source);  
}  
\_root.list\_comp.selectedIndex = 0;  
}

//create a listener for the list component  
var compListener:Object = new Object();  
list\_comp.addEventListener(“change”, compListener);

compListener.change = function(info:Object):Void{  
playTrack(info.target.value,tracks\_array[list\_comp.selectedIndex].artist,tracks\_array[list\_comp.selectedIndex].album,tracks\_array[list\_comp.selectedIndex].title, true);  
}

//this controls download bar and playback

function songProgress():Void{  
amountLoaded = (mySound.getBytesLoaded()/mySound.getBytesTotal());  
progressbars\_mc.downloadbar\_mc.\_width = amountLoaded \* 200;  
progressbars\_mc.playback\_mc.\_x = (mySound.position/mySound.duration)\*amountLoaded \* 200;  
position\_txt.text = mySound.position;  
duration\_txt.text = mySound.duration;  
playback\_txt.text = progressbars\_mc.playback\_mc.\_x;  
}

//controls  
var soundPosition:Number;  
var paused:Boolean = false;

controlbar\_mc.pause\_btn.onRelease = function():Void{  
soundPosition = mySound.position;  
paused = true;  
mySound.stop();  
}

controlbar\_mc.play\_btn.onRelease = function():Void{  
if(paused){  
mySound.start(soundPosition/1000);  
paused = false;  
}  
this.\_parent.volume1.dragger.onPress = function() {  
startDrag(this, true, 0, this.\_y, this.\_parent.volBG.\_width, this.\_y);  
\_root.toolTip.\_visible = true;  
setInterval(draggableTip,100);  
function draggableTip(){  
\_root.toolTip.\_x = \_root.\_xmouse;  
}  
this.onEnterFrame = function() {  
var p = (this.\_x/this.\_parent.volBG.\_width)\*100;  
this.\_parent.\_parent.sound\_mc.sound\_obj.setVolume§;

```
	};
};
this._parent.volume1.dragger.onRelease = function() {
	delete this.onEnterFrame;
	stopDrag();
	
};
this._parent.volume1.dragger.onReleaseOutside = function() {
	_root.toolTip._visible = false;
	stopDrag();
	
};

```

}

Any help would really be appreciated thanks so much in advance.

antegrav
