System.useCodepage = true;
function realStart() {
for (var i = 1; i<=5; i++) {
this["but"+i]._visible = true;
this["but"+i].shine.gotoAndPlay(2);
}
but1.sym.gotoAndStop(2);
but2.sym.gotoAndStop(1);
but3.sym.gotoAndStop(4);
but4.sym.gotoAndStop(6);
but5.sym.gotoAndStop(5);
isplaying = false;
this.onEnterFrame = function() {
// if (bar.hitTest(_parent._xmouse, _parent._ymouse)) {
// bar.go();
// } else {
// bar.hold();
// }
vol += vol_spd;
if (vol>100) {
vol = 100;
}
if (vol<0) {
vol = 0;
}
snd.setVolume(int(vol));
vol_spd *= 1.1;
};
}
// :::: init player ::::
var isplaying = false;
var vol_spd = 0;
var vol = 100;
but1._visible = false;
but2._visible = false;
but3._visible = false;
var snd = new Sound(this);
snd.onSoundComplete = function() {
if (isplaying) {
this.start();
}
};
var files = new Array();
var infos = new Array();
var current_song = 0;
var xm = new XML();
xm.ignoreWhite = true;
xm.onLoad = function() {
for (var i = 0; i<this.childNodes.length; i++) {
files[i] = this.childNodes[i].attributes.src;
infos[i] = this.childNodes[i].attributes.info;
}
begin();
};
xm.load("playlist.xml");
function begin() {
this.onEnterFrame = function() {
// display.setDisplay(infos[0]);
realStart();
};
}
// :::: actions ::::
function togglePlay() {
isplaying = !isplaying;
if (isplaying) {
but3.sym.gotoAndStop(3);
display.setDisplay(infos[current_song]);
trace("PLAY SONG: "+files[current_song]);
snd.loadSound(files[current_song], true);
snd.start();
bar.go();
} else {
but3.sym.gotoAndStop(4);
display.setDisplay("");
snd.stop();
bar.hold();
}
}
function volUp() {
vol_spd = 1;
}
function volDown() {
vol_spd = -1;
}
function stopVol() {
vol_spd = 0;
}
function nextSong() {
current_song++;
if (current_song>=files.length) {
current_song = 0;
}
if (current_song<0) {
current_song = files.length-1;
}
isplaying = false;
togglePlay();
}
function previousSong() {
current_song--;
if (current_song>=files.length) {
current_song = 0;
}
if (current_song<0) {
current_song = files.length-1;
}
isplaying = false;
togglePlay();
}