# XML mp3 player HELP!

**URL:** <https://forum.kirupa.com/t/xml-mp3-player-help/179418>\
**Category:** flash\
**Created:** [February 20, 2006, 2:16am UTC](https://forum.kirupa.com/t/xml-mp3-player-help/179418 "2006-02-20T02:16:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bandsaw](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@bandsaw](https://forum.kirupa.com/u/bandsaw)\
**Post date:** [February 20, 2006, 2:16am UTC](https://forum.kirupa.com/t/xml-mp3-player-help/179418/1 "2006-02-20T02:16:08Z")

</div>

Im still very new to AS, but i need some help, please. i used a tutorial to build an XMl mp3 player but the AS is set to use the player on the root of the movie. Can someone help me to change the AS so i can load it anyway i want(i.e. attachMovie(), loadMovie() ect.)

thanks

heres the script:

stop();  
playlist = new XML();  
playlist.ignoreWhite = true;  
playlist.onLoad = function(success) {  
if (success) {  
\_global.songname = [];  
\_global.songband = [];  
\_global.songfile = [];  
for (var i = 0; i\<playlist.firstChild.childNodes.length; i++) {  
\_global.songname\* = playlist.firstChild.childNodes\*.attributes.name;  
\_global.songband\* = playlist.firstChild.childNodes\*.attributes.band;  
\_global.songfile\* = playlist.firstChild.childNodes\*.attributes.file;  
// trace(songname\*+" “+songfile\*+” “+songband\*);  
}  
}  
\_root.createEmptyMovieClip(“sound\_mc”, 1);  
\_global.song\_nr = random(songfile.length);  
\_root.sound\_mc.songStarter(songfile[song\_nr], songname[song\_nr], songband[song\_nr]);  
};  
function timer(sound\_obj) {  
time = sound\_obj.position/1000;  
min = Math.floor(time/60);  
min = (min\<10) ? “0”+min : min;  
sec = Math.floor(time%60);  
sec = (sec\<10) ? “0”+sec : sec;  
timeDisplay\_txt.text = min+”:"+sec;  
}  
MovieClip.prototype.songStarter = function(file, name, band) {  
if (this.sound\_obj) {  
this.sound\_obj.stop();  
delete this.sound\_obj;  
}  
this.sound\_obj = new Sound(this);  
this.sound\_obj.loadSound(file, true);  
this.onEnterFrame = function() {  
if (this.sound\_obj.position\>0) {  
delete this.onEnterFrame;  
this.\_root.display\_txt.text = name+" / "+band;  
timeInterval = setInterval(timer, 1000, this.sound\_obj);  
} else {  
this.\_root.display\_txt.text = “loading…”;  
}  
};  
this.sound\_obj.onSoundComplete = function() {  
clearInterval(timeInterval);  
this.\_root.timeDisplay\_txt.text = “00:00”;  
(song\_nr == songfile.length-1) ? \_global.song\_nr=0 : \_global.song\_nr++;  
\_root.sound\_mc.songStarter(songfile[song\_nr], songname[song\_nr], songband[song\_nr]);  
};  
this.\_root.volume1.dragger.onPress = function() {  
startDrag(this, true, 0, this.\_y, this.\_root.volBG.\_width, this.\_y);  
this.onEnterFrame = function() {  
var p = (this.\_x/this.\_root.volBG.\_width)\*100;  
this.\_root.\_root.sound\_mc.sound\_obj.setVolume§;  
};  
};  
this.\_root.volume1.dragger.onRelease = function() {  
delete this.onEnterFrame;  
stopDrag();  
};  
this.\_root.volume1.dragger.onReleaseOutside = function() {  
stopDrag();  
};  
};  
btn\_play.onRelease = function() {  
clearInterval(timeInterval);  
this.\_root.timeDisplay\_txt.text = “00:00”;  
this.\_root.sound\_mc.songStarter(songfile[song\_nr], songname[song\_nr], songband[song\_nr]);  
};  
btn\_stop.onRelease = function() {  
clearInterval(timeInterval);  
this.\_root.timeDisplay\_txt.text = “00:00”;  
this.\_root.sound\_mc.sound\_obj.stop();  
};  
btn\_fw.onRelease = function() {  
clearInterval(timeInterval);  
this.\_parent.timeDisplay\_txt.text = “00:00”;  
(song\_nr == songfile.length-1) ? \_global.song\_nr=0 : \_global.song\_nr++;  
\_root.sound\_mc.songStarter(songfile[song\_nr], songname[song\_nr], songband[song\_nr]);  
};  
btn\_rev.onRelease = function() {  
clearInterval(timeInterval);  
this.\_parent.timeDisplay\_txt.text = “00:00”;  
(song\_nr == 0) ? \_global.song\_nr=songfile.length-1 : \_global.song\_nr–;  
\_root.sound\_mc.songStarter(songfile[song\_nr], songname[song\_nr], songband[song\_nr]);  
};  
playlist.load(“playlist.xml”);
