Frame 1
function millisecondsToString(position) {
var _local1 = new Date();
var _local2;
var _local3;
var hours;
_local1.setSeconds(int(position / 1000));
_local1.setMinutes(int((position / 1000) / 60));
_local1.setHours(int(((position / 1000) / 60) / 60));
_local2 = _local1.getSeconds();
_local3 = _local1.getMinutes();
hours = _local1.getHours();
if (_local2 < 10) {
_local2 = "0" + _local2.toString();
}
if (_local3 < 10) {
_local3 = "0" + _local3.toString();
}
if (hours < 10) {
hours = "0" + hours.toString();
}
return((((hours + ":") + _local3) + ":") + _local2);
}
src = ((soundFile == undefined) ? "" : (soundFile));
if (autostart == "yes") {
autoOpen = true;
} else {
autoOpen = false;
}
autostart = undefined;
closePlayer = false;
setcolors = true;
emff = new Object();
emff.mySound = new Array();
emff.playedmsec = 0;
emff.index = 0;
emff.status = 0;
emff.dragpos = false;
emff.dragvol = false;
emff.STOPPED = 0;
emff.PLAYING = 1;
emff.PAUSED = 2;
emff.loop = false;
emff.autostart = false;
emff.streaming = true;
emff.src = src.split(",");
emff.isLoaded = new Array();
emff.getSoundNumber = function () {
return(emff.src.length);
};
i = 0;
while (i < emff.getSoundNumber()) {
emff.isLoaded.push(false);
emff.mySound.push(new Sound());
i++;
}
emff.setVolume = function (vol) {
var _local1 = vol;
if (_local1 < 0) {
_local1 = 0;
}
if (_local1 > 100) {
_local1 = 100;
}
i = 0;
while (i < emff.getSoundNumber()) {
emff.mySound[i].setVolume(_local1);
i++;
}
};
emff.setVolume(100);
emff.loadSelectedSound = function () {
emff.mySound[emff.index].loadSound(emff.src[emff.index], emff.streaming);
emff.isLoaded[emff.index] = true;
};
emff.ctrlBegin = function () {
if (emff.status != emff.STOPPED) {
emff.mySound[emff.index].stop();
}
emff.index = 0;
if (!emff.isLoaded[emff.index]) {
emff.loadSelectedSound();
}
emff.mySound[emff.index].start();
emff.status = emff.PLAYING;
};
emff.ctrlStop = function () {
if (emff.status != emff.STOPPED) {
emff.mySound[emff.index].stop();
emff.status = emff.STOPPED;
}
};
emff.ctrlPause = function () {
if (emff.status == emff.PLAYING) {
emff.playedmsec = emff.mySound[emff.index].position;
emff.mySound[emff.index].stop();
emff.status = emff.PAUSED;
}
};
emff.ctrlPlay = function () {
if (emff.status == emff.STOPPED) {
if (!emff.isLoaded[emff.index]) {
emff.loadSelectedSound();
}
emff.mySound[emff.index].start();
emff.status = emff.PLAYING;
}
if (emff.status == emff.PAUSED) {
emff.mySound[emff.index].start(Math.round(emff.playedmsec / 1000));
emff.status = emff.PLAYING;
}
};
emff.ctrlPrevious = function () {
emff.mySound[emff.index].stop();
if (emff.index <= 0) {
emff.index = emff.getSoundNumber() - 1;
} else {
emff.index = emff.index - 1;
}
if (emff.status != emff.STOPPED) {
if (!emff.isLoaded[emff.index]) {
emff.loadSelectedSound();
}
emff.mySound[emff.index].start();
emff.status = emff.PLAYING;
}
};
emff.ctrlNext = function () {
emff.mySound[emff.index].stop();
if (emff.index >= (emff.getSoundNumber() - 1)) {
emff.index = 0;
} else {
emff.index = emff.index + 1;
}
if (emff.status != emff.STOPPED) {
if (!emff.isLoaded[emff.index]) {
emff.loadSelectedSound();
}
emff.mySound[emff.index].start();
emff.status = emff.PLAYING;
}
};
i = 0;
while (i < emff.getSoundNumber()) {
emff.mySound[i].onSoundComplete = function () {
emff.mySound[emff.index].stop();
if (emff.index < (emff.getSoundNumber() - 1)) {
emff.ctrlNext();
} else if (emff.loop) {
emff.ctrlNext();
} else {
emff.index = 0;
emff.status = emff.STOPPED;
}
};
i++;
}
emff.getLoaded = function () {
if (!emff.isLoaded[emff.index]) {
return(0);
}
return(emff.mySound[emff.index].getBytesLoaded() / emff.mySound[emff.index].getBytesTotal());
};
emff.getPlayed = function () {
if (emff.status == emff.STOPPED) {
return(0);
}
if (emff.status == emff.PLAYING) {
loaded = emff.mySound[emff.index].getBytesLoaded() / emff.mySound[emff.index].getBytesTotal();
playedmsec = emff.mySound[emff.index].position;
totalmsec = (1 / loaded) * emff.mySound[emff.index].duration;
return(playedmsec / totalmsec);
}
if (emff.status == emff.PAUSED) {
loaded = emff.mySound[emff.index].getBytesLoaded() / emff.mySound[emff.index].getBytesTotal();
playedmsec = emff.playedmsec;
totalmsec = (1 / loaded) * emff.mySound[emff.index].duration;
return(playedmsec / totalmsec);
}
return(0);
};
if (autostart == "yes") {
emff.autostart = true;
}
if (loop == "yes") {
emff.loop = true;
}
if (streaming == "no") {
emff.streaming = false;
}
_global.emff = emff;
emff.id3Tags = new Array(emff.getSoundNumber());
i = 0;
while (i < emff.getSoundNumber()) {
emff.mySound[i].error = false;
emff.mySound[i].index = i;
emff.id3Tags[i].loaded = false;
emff.mySound[i].onLoad = function (success) {
this.error = !success;
};
emff.mySound[i].onID3 = function () {
var _local1 = this;
emff.id3Tags[_local1.index] = new Object();
emff.id3Tags[_local1.index].data = new Array();
emff.id3Tags[_local1.index].data[0] = _local1.id3.artist;
emff.id3Tags[_local1.index].data[1] = _local1.id3.songname;
emff.id3Tags[_local1.index].loaded = true;
};
i++;
}
emff.getSongInfo = function () {
return(emff.id3Tags[emff.index]);
};
emff.getError = function () {
return(emff.mySound[emff.index].error);
};
emff.getPosition = function () {
return(emff.mySound[emff.index].position);
};
emff.getDuration = function () {
return(emff.mySound[emff.index].duration);
};
_global.player = new Object();
player.maxVolume = 100;
player.volume = player.maxVolume;
player.fadeOut = false;
player.buffering = true;
player.setcolors = false;
player.CLOSED = 0;
player.OPENING = 1;
player.OPEN = 2;
player.CLOSING = 3;
player.status = player.CLOSED;
player.close = function () {
if (player.status != player.OPEN) {
return(undefined);
}
player.status = player.CLOSING;
player.fadeOut = true;
closePlayer = false;
_root.speaker_mc.gotoAndStop("off");
_root.play();
};
player.open = function () {
if (player.status != player.CLOSED) {
return(undefined);
}
player.status = player.OPENING;
_root.play();
if (playerID != undefined) {
getURL (("javascript:ap_stopAll(" + playerID) + ")");
}
};
_root.control_mc.onRelease = function () {
switch (player.status) {
case player.CLOSED :
player.open();
return;
case player.OPEN :
player.close();
}
};
_root.control_mc.hover = false;
_root.control_mc.state = "play";
_root.control_mc.onRollOver = function () {
_root.control_mc.hover = true;
};
_root.control_mc.onRollOut = function () {
_root.control_mc.hover = false;
};
_root.control_mc.onEnterFrame = function () {
var _local1 = this;
if (_local1.state == "play") {
_local1.pause_icon_mc._visible = (_local1.pause_hover_icon_mc._visible = false);
_local1.play_icon_mc._visible = !_local1.hover;
_local1.play_hover_icon_mc._visible = _local1.hover;
} else {
_local1.play_icon_mc._visible = (_local1.play_hover_icon_mc._visible = false);
_local1.pause_icon_mc._visible = !_local1.hover;
_local1.pause_hover_icon_mc._visible = _local1.hover;
}
_local1.btn_hover_background_mc._visible = _local1.hover;
_local1.btn_background_mc._visible = !_local1.hover;
};
_root.progress_mc.progress_button_mc.onPress = function () {
emff.ctrlPause();
var _local1 = Math.floor((186 * emff.getLoaded()) - 3);
startDrag (this, false, -3, -2, _local1, -2);
emff.dragpos = true;
updateAfterEvent();
};
_root.progress_mc.progress_button_mc.onRelease = (_root.progress_mc.progress_button_mc.onReleaseOutside = function () {
stopDrag();
var _local1 = (this._x + 3) / 186;
var _local2 = emff.getLoaded();
if (_local1 > _local2) {
_local1 = _local2;
}
emff.playedmsec = Math.round(((1 / _local2) * emff.getDuration()) * _local1);
emff.ctrlPlay();
emff.dragpos = false;
});
_root.songInfo_mc.started = false;
_root.songInfo_mc.index = -1;
_root.songInfo_mc.pause = true;
_root.songInfo_mc.pauseLength = 60;
_root.songInfo_mc.scrollStep = 1;
_root.songInfo_mc.pauseCounter = 0;
_root.songInfo_mc.useHandCursor = false;
_root.songInfo_mc.onRelease = function () {
this.textMask_mc.gotoAndPlay("next");
};
_root.songInfo_mc.nextField = function (newIndex) {
var _local1 = this;
if (!_local1.started) {
_local1.started = true;
}
if (newIndex != undefined) {
_local1.index = newIndex;
} else if (_local1.index == (emff.getSongInfo().data.length - 1)) {
_local1.index = 0;
} else {
_local1.index++;
}
_local1.input_txt.text = emff.getSongInfo().data[_local1.index];
_local1.input_txt.hscroll = 0;
_local1.pause = true;
_local1.forward = true;
_local1.pauseCounter = 0;
_local1.textMask_mc.gotoAndPlay("start");
};
_root.songInfo_mc.onEnterFrame = function () {
var _local1 = this;
_local1.input_txt.background = false;
if ((_local1.input_txt.length == 0) || (_local1.input_txt.maxhscroll == 0)) {
} else if (_local1.pause) {
if (_local1.pauseCounter == _local1.pauseLength) {
_local1.pause = false;
_local1.pauseCounter = 0;
// unexpected jump
}
_local1.pauseCounter++;
} else if (_local1.forward) {
_local1.input_txt.hscroll = _local1.input_txt.hscroll + _local1.scrollStep;
if (_local1.input_txt.hscroll >= _local1.input_txt.maxhscroll) {
_local1.forward = false;
_local1.pause = true;
return;
}
} else {
_local1.input_txt.hscroll = _local1.input_txt.hscroll - _local1.scrollStep;
if (_local1.input_txt.hscroll == 0) {
_local1.pause = true;
_local1.forward = true;
}
}
};
lastPosition = 0;
frameCount = 0;
trackIndex = 0;
_root.onEnterFrame = function () {
if (setcolors) {
player.setColors();
setcolors = false;
}
if (closePlayer) {
player.close();
}
if (emff.getSoundNumber() == 0) {
player.error = true;
} else {
player.error = emff.getError();
}
if (player.error) {
_root.progress_mc.progress_button_mc._visible = false;
_root.speaker_mc.gotoAndStop("off");
_root.messages_txt.text = "Error opening file";
_root.messages_txt._visible = player.status == player.OPEN;
_root.position_txt._visible = false;
_root.songInfo_mc._visible = false;
return(undefined);
}
_root.position_txt._visible = true;
if (player.fadeOut) {
player.volume = player.volume - 8;
if (player.volume < 10) {
emff.ctrlPause();
player.fadeOut = false;
}
} else if (player.status == player.OPEN) {
player.volume = player.maxVolume;
}
emff.setVolume(player.volume);
_root.progress_mc.loading_mc._width = Math.round(emff.getLoaded() * 200);
if (player.buffering) {
_root.messages_txt.text = "Buffering...";
_root.messages_txt._visible = true;
_root.songInfo_mc._visible = false;
} else {
_root.messages_txt._visible = false;
with (_root.songInfo_mc) {
if (_global.emff.getSongInfo().loaded) {
if (_root.trackIndex != emff.index) {
_root.trackIndex = emff.index;
nextField(0);
} else if (!started) {
nextField();
}
_visible = true;
} else {
_visible = false;
}
}
}
switch (emff.status) {
case emff.PLAYING :
frameCount++;
if (frameCount == 5) {
frameCount = 0;
player.buffering = emff.getPosition() == lastPosition;
lastPosition = emff.getPosition();
}
_root.progress_mc.progress_button_mc._visible = true;
if (!emff.dragpos) {
_root.progress_mc.progress_button_mc._x = Math.round((emff.getPlayed() * 186) - 3);
}
_root.position_txt.text = millisecondsToString(emff.getPosition());
_root.control_mc.state = "pause";
break;
case emff.PAUSED :
_root.position_txt.text = millisecondsToString(emff.getPosition());
if (!emff.dragpos) {
_root.control_mc.state = "play";
}
break;
case emff.STOPPED :
lastPosition = 0;
_root.progress_mc.progress_button_mc._visible = false;
_root.position_txt.text = millisecondsToString(0);
_root.progress_mc.progress_button_mc._x = -3;
_root.control_mc.state = "play";
player.close();
}
if (player.status != player.OPEN) {
_root.messages_txt._visible = false;
_root.songInfo_mc._visible = false;
_root.position_txt._visible = false;
}
};
player.setColors = function () {
var _local2;
var _local1 = new Object();
_local1.bg = bg;
_local1.leftbg = leftbg;
_local1.lefticon = lefticon;
_local1.rightbg = rightbg;
_local1.rightbghover = rightbghover;
_local1.righticon = righticon;
_local1.righticonhover = righticonhover;
_local1.text = text;
_local1.slider = slider;
_local1.track = track;
_local1.loader = loader;
_local1.border = border;
if (_local1.bg != undefined) {
_local2 = new Color(background_mc);
_local2.setRGB(_local1.bg);
_local2 = new Color(songInfo_mc.textmask_mc);
_local2.setRGB(_local1.bg);
}
if (_local1.leftbg != undefined) {
_local2 = new Color(left_background_mc);
_local2.setRGB(_local1.leftbg);
}
if (_local1.lefticon != undefined) {
_local2 = new Color(speaker_mc);
_local2.setRGB(_local1.lefticon);
}
if (_local1.rightbg != undefined) {
_local2 = new Color(control_mc.btn_background_mc);
_local2.setRGB(_local1.rightbg);
}
if (_local1.rightbghover != undefined) {
_local2 = new Color(control_mc.btn_hover_background_mc);
_local2.setRGB(_local1.rightbghover);
}
if (_local1.righticon != undefined) {
_local2 = new Color(control_mc.play_icon_mc);
_local2.setRGB(_local1.righticon);
_local2 = new Color(control_mc.pause_icon_mc);
_local2.setRGB(_local1.righticon);
}
if (_local1.righticonhover != undefined) {
_local2 = new Color(control_mc.play_hover_icon_mc);
_local2.setRGB(_local1.righticonhover);
_local2 = new Color(control_mc.pause_hover_icon_mc);
_local2.setRGB(_local1.righticonhover);
}
if (_local1.text != undefined) {
messages_txt.textColor = (position_txt.textColor = (songInfo_mc.input_txt.textColor = _local1.text));
}
if (_local1.slider != undefined) {
_local2 = new Color(progress_mc.progress_button_mc);
_local2.setRGB(_local1.slider);
}
if (_local1.track != undefined) {
_local2 = new Color(progress_mc.track_mc);
_local2.setRGB(_local1.track);
}
if (_local1.loader != undefined) {
_local2 = new Color(progress_mc.loader_mc);
_local2.setRGB(_local1.loader);
}
if (_local1.border != undefined) {
_local2 = new Color(progress_mc.border_mc);
_local2.setRGB(_local1.border);
}
};
Frame 2
player.status = player.CLOSED;
if (autoOpen) {
play();
} else {
stop();
}
Frame 3
autoOpen = false;
Frame 16
player.status = player.OPEN;
emff.ctrlPlay();
_root.speaker_mc.gotoAndPlay("on");
stop();
Frame 26
gotoAndStop ("closed");
Symbol 17 MovieClip Frame 1
stop();
Symbol 17 MovieClip Frame 270
stop();
_parent.nextField();
Symbol 25 MovieClip Frame 1
stop();
Symbol 25 MovieClip Frame 22
gotoAndPlay ("on");