1. Rettelse: Mit navn er Maqhem.
2. Har du prøvet det endelige script af?
SongPlayer = function(path,number,autoplay) {
this.path = path;
this.number = number;
this.nextSong(autoplay);
}
SongPlayer.prototype.initList = function() {
this.unused = new Array();
var i;
for (i = 1; i <= this.number; i++)
this.unused.push(i);
this.unused.sort(function(a,b){ return random(3)-1; });
}
SongPlayer.prototype.play = function() {
this.sound.start();
}
SongPlayer.prototype.nextSong = function(go_on) {
delete this.sound.songPlayer;
delete this.sound;
this.sound = new Sound(_root);
this.sound.songPlayer = this;
this.sound.onSoundComplete = function() {
this.songPlayer.nextSong(true);
}
if (!this.unused.length)
this.initList();
this.sound.loadSound(this.path+this.unused.pop()+".mp3", true);
if (go_on)
this.play();
}
SongPlayer.prototype.stop = function() {
this.sound.stop();
}
SongPlayer.prototype.pause = function() {
this.paused = true;
this.position = this.sound.position/1000;
this.sound.stop();
}
SongPlayer.prototype.resume = function() {
this.paused = false;
this.sound.start(this.position);
}
SongPlayer.prototype.isPaused = function() {
return this.paused;
}
mySongPlayer = new SongPlayer("
http://www.theselfimages.dk/images/music/", 9, true);