# Making MP3 player play next track automatically

**URL:** https://forum.kirupa.com/t/making-mp3-player-play-next-track-automatically/181622
**Category:** flash
**Created:** [March 10, 2006, 11:28pm UTC](https://forum.kirupa.com/t/making-mp3-player-play-next-track-automatically/181622 "2006-03-10T23:28:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![whuzi](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/whuzi/32/1284_2.png) [@whuzi](https://forum.kirupa.com/u/whuzi)
#### Post date: [March 10, 2006, 11:28pm UTC](https://forum.kirupa.com/t/making-mp3-player-play-next-track-automatically/181622/1 "2006-03-10T23:28:34Z")

</div>

Heres my site so you can see what I mean…  
[http://www.afterthesmoke.com](http://www.afterthesmoke.com)

On the first page, my player begins to play like a radio show. i have different sections which are all individual tracks. the player works and plays each track when i manually press next or previous…but it doesn’t automatically play through all the tracks. instead it pauses after the first track and i have to manually press next.

here is what i used…can you find the problem please:

stop();  
playlist = new XML();  
playlist.ignoreWhite=true;  
playlist.onload = function (success) {  
if(success) {  
\_global.songname = [];  
\_global.songfile = [];  
for (var i=0; i\<playlist.firstChild.childNodes.length; i++) {  
\_global.songname\* = playlist.firstChild.childNodes\*.attributes.name;  
\_global.songfile\* = playlist.firstChild.childNodes\*.attributes.file;  
trace(songname\*+" "+songfile\*);  
}  
\_root.createEmptyMovieClip(“sound\_mc”,1);  
\_root.sound\_mc.sound\_obj = new Sound();  
\_root.sound\_mc.songStarter(songfile[0],songname[0]);  
} else {display\_txt.text=“Error loading XML”}  
}  
MovieClip.prototype.songStarter = function (file, name) {  
this.sound\_obj.loadSound(file,true)  
this.onEnterFrame = function () {  
if(this.sound\_obj.position\>0) {  
delete this.onEnterFrame;  
this.\_parent.display\_txt.text=name;  
} else {  
this.\_parent.display\_txt.text=“loading…”  
}  
}  
}  
playlist.load(“playlist.xml”);  
this.sound\_obj.onSoundComplete = function (){  
(song\_nr==songfile.length-1)? \_global.song\_nr=0 : \_global.song\_nr++;  
\_root.sound\_mc.songStarter(songfile[song\_nr],songname[song\_nr]);  
}  
btn\_play.onRelease = function () {  
this.\_parent.sound\_mc.songStarter(songfile[song\_nr],songname[song\_nr]);  
}  
btn\_stop.onRelease = function() {  
this.\_parent.sound\_mc.sound\_obj.stop();  
}  
btn\_next.onRelease = function () {  
(song\_nr==songfile.length-1)? \_global.song\_nr=0 : \_global.song\_nr++;  
\_root.sound\_mc.songStarter(songfile[song\_nr],songname[song\_nr]);  
}  
btn\_prev.onRelease = function () {  
(song\_nr==0)? \_global.song\_nr=songfile.length-1 : \_global.song\_nr–;  
\_root.sound\_mc.songStarter(songfile[song\_nr],songname[song\_nr]);  
}  
playlist.load(“playlist.xml”);
