Frame 1
if (_root.soundfile != undefined) {
_root.soundFile = _root.soundfile;
}
var options = new Object();
if (_root.playerID != undefined) {
options.playerID = _root.playerID;
}
if (_root.demomode == "yes") {
options.demomode = true;
} else if (_root.demomode == "no") {
options.demomode = false;
}
if (_root.autostart == "yes") {
options.autostart = true;
} else if (_root.autostart == "no") {
options.autostart = false;
}
if (_root.animation == "no") {
options.animation = false;
} else if (_root.animation == "yes") {
options.animation = true;
}
if (_root.loop == "yes") {
options.loop = true;
} else if (_root.loop == "no") {
options.loop = false;
}
if (_root.encode == "yes") {
options.encode = true;
} else if (_root.encode == "no") {
options.encode = false;
}
if (_root.remaining == "yes") {
options.remaining = true;
} else if (_root.remaining == "no") {
options.remaining = false;
}
if (_root.noinfo == "yes") {
options.noinfo = true;
} else if (_root.noinfo == "no") {
options.noinfo = false;
}
if (_root.killdownload == "yes") {
options.killdownload = true;
} else if (_root.killdownload == "no") {
options.killdownload = false;
}
if (_root.checkpolicy == "yes") {
options.checkpolicy = true;
} else if (_root.checkpolicy == "no") {
options.checkpolicy = false;
}
if (_root.rtl == "yes") {
options.rtl = true;
} else if (_root.rtl == "no") {
options.rtl = false;
}
if (_root.initialvolume != undefined) {
options.volume = _root.initialvolume;
}
if (_root.buffer != undefined) {
options.bufferTime = _root.buffer;
}
if (_root.titles != undefined) {
options.titles = _root.titles;
}
if (_root.artists != undefined) {
options.artists = _root.artists;
}
Application.start(_root.soundFile, options);
Symbol 12 MovieClip [Volume] Frame 1
#initclip 16
Object.registerClass("Volume", Volume);
#endinitclip
Symbol 19 MovieClip [Progress] Frame 1
#initclip 12
Object.registerClass("Progress", Progress);
#endinitclip
Symbol 23 MovieClip [Loading] Frame 1
#initclip 13
Object.registerClass("Loading", Loading);
#endinitclip
Symbol 33 MovieClip [Control] Frame 1
#initclip 14
Object.registerClass("Control", Control);
#endinitclip
Symbol 38 MovieClip [Display] Frame 1
#initclip 15
Object.registerClass("Display", Display);
#endinitclip
Symbol 43 MovieClip [__Packages.Application] Frame 0
class Application
{
static var _player, _state, masked_mc, background_mc, progress_mc, loading_mc, next_mc, previous_mc, mask_mc, display_mc, volume_mc, control_mc, _clearID;
function Application () {
}
static function start(sourceFile, options) {
if (options != undefined) {
_setOptions(options);
}
if ((!_options.demomode) && (_options.encode)) {
sourceFile = _sixBitDecode(sourceFile);
}
if (!_options.demomode) {
var _local1 = new Object();
_local1.initialVolume = _options.volume;
_local1.bufferTime = _options.bufferTime;
_local1.enableCycling = _options.loop;
_local1.playerID = _options.playerID;
_local1.checkPolicy = _options.checkpolicy;
_player = new net.onepixelout.audio.Player(_local1);
var _local5 = ((_options.titles != undefined) ? (_options.titles) : "");
var _local3 = ((_options.artists != undefined) ? (_options.artists) : "");
_player.loadPlaylist(sourceFile, _local5, _local3);
if (!_options.demomode) {
_player.addListener(Application);
}
}
_state = CLOSED;
if ((_options.demomode || (!_options.animation)) || (_options.autostart)) {
_state = OPEN;
}
_setStage();
_setColors(true);
if (flash.external.ExternalInterface.available) {
flash.external.ExternalInterface.addCallback("load", Application, ei_loadFile);
flash.external.ExternalInterface.addCallback("close", Application, ei_closePlayer);
flash.external.ExternalInterface.addCallback("open", Application, ei_openPlayer);
flash.external.ExternalInterface.addCallback("setVolume", Application, ei_setVolume);
flash.external.ExternalInterface.addCallback("addListener", Application, addJSListener);
flash.external.ExternalInterface.addCallback("removeListener", Application, removeJSListener);
var _local2 = Number(flash.external.ExternalInterface.call("AudioPlayer.getVolume", _options.playerID));
if (_local2 > -1) {
_player.setVolume(_local2, true);
}
}
if ((!_options.demomode) && (_options.autostart)) {
onPlay();
}
setInterval(_update, 100);
if (flash.external.ExternalInterface.available) {
flash.external.ExternalInterface.call("onWPPlayerReady", _options.playerID);
}
}
static function _setOptions(options) {
for (var _local2 in options) {
_options[_local2] = options[_local2];
}
}
static function _setStage() {
Stage.align = "L";
Stage.scaleMode = "noScale";
var _local2 = _root.getNextHighestDepth();
masked_mc = _root.createEmptyMovieClip("masked_mc", _local2++);
background_mc = masked_mc.attachMovie("Background", "background_mc", 0);
progress_mc = masked_mc.attachMovie("Progress", "progress_mc", 1);
progress_mc.addListener(Application);
loading_mc = masked_mc.attachMovie("Loading", "loading_mc", 2);
if (_options.demomode || (_player.getTrackCount() > 1)) {
next_mc = masked_mc.attachMovie("Toggle", "next_mc", 3);
previous_mc = masked_mc.attachMovie("Toggle", "previous_mc", 4);
previous_mc._rotation = -180;
if (!_options.demomode) {
next_mc.onRelease = function () {
Application._player.next();
Application.display_mc.setTime(0);
};
previous_mc.onRelease = function () {
Application._player.previous();
Application.display_mc.setTime(0);
};
}
}
mask_mc = _root.attachMovie("Mask", "mask_mc", _local2++);
masked_mc.setMask(mask_mc);
mask_mc._width = 8;
display_mc = _root.attachMovie("Display", "display_mc", _local2++);
if (_state == CLOSED) {
display_mc._visible = false;
}
volume_mc = _root.attachMovie("Volume", "volume_mc", _local2++);
volume_mc.addListener(Application);
control_mc = _root.attachMovie("Control", "control_mc", _local2++, {state:(_options.autostart ? "pause" : "play")});
control_mc.addListener(Application);
_alignAndResize();
if (_options.demomode) {
control_mc.toggle();
volume_mc.toggleControl(true);
volume_mc.update(_options.volume);
progress_mc.updateProgress(0.3);
loading_mc.update(0.6);
display_mc.setText("1 Pixel Out: Demo Mode", 0, true);
display_mc.setTime(356560, _options.remaining);
previous_mc._alpha = 50;
}
Stage.addListener(Application);
}
static function _alignAndResize() {
background_mc._x = volume_mc.realWidth - 7;
var _local1 = _player.getTrackCount();
progress_mc._x = volume_mc.realWidth + 4;
if (_options.demomode || (_local1 > 1)) {
progress_mc._x = progress_mc._x + 8;
}
progress_mc._y = 2;
loading_mc._x = volume_mc.realWidth + 4;
if (_options.demomode || (_local1 > 1)) {
loading_mc._x = loading_mc._x + 8;
}
loading_mc._y = 20;
if (_options.demomode || (_local1 > 1)) {
next_mc._x = Stage.width - 43;
next_mc._y = 12;
previous_mc._x = volume_mc.realWidth + 6;
previous_mc._y = 12;
}
mask_mc._x = volume_mc.realWidth - 7;
display_mc._x = volume_mc.realWidth + 6;
if (_options.demomode || (_local1 > 1)) {
display_mc._x = display_mc._x + 8;
}
display_mc._y = 2;
if (_state == CLOSED) {
control_mc._x = volume_mc.realWidth - 6;
} else {
control_mc._x = Stage.width - control_mc.realWidth;
}
if (_options.rtl) {
control_mc.flip();
volume_mc.flip();
volume_mc._x = Stage.width - volume_mc.realWidth;
background_mc._x = control_mc.realWidth - 7;
progress_mc._x = control_mc.realWidth + 4;
if (_options.demomode || (_local1 > 1)) {
progress_mc._x = progress_mc._x + 4;
}
progress_mc._y = 2;
loading_mc._x = control_mc.realWidth + 4;
if (_options.demomode || (_local1 > 1)) {
loading_mc._x = loading_mc._x + 4;
}
loading_mc._y = 20;
if (_options.demomode || (_local1 > 1)) {
next_mc._x = Stage.width - 52;
next_mc._y = 12;
previous_mc._x = control_mc.realWidth + 2;
previous_mc._y = 12;
}
mask_mc._rotation = 180;
mask_mc._y = mask_mc._height;
mask_mc._x = volume_mc._x + 7;
display_mc._x = control_mc.realWidth + 6;
if (_options.demomode || (_local1 > 1)) {
display_mc._x = display_mc._x + 4;
}
display_mc._y = 2;
if (_state == CLOSED) {
control_mc._x = (volume_mc._x - control_mc.realWidth) + 6;
} else {
control_mc._x = 0;
}
}
var _local2 = Stage.width - (control_mc.realWidth + volume_mc.realWidth);
background_mc._width = _local2 + 14;
if (_state == OPEN) {
mask_mc._width = _local2 + 14;
}
if (_options.demomode || (_local1 > 1)) {
_local2 = _local2 - 12;
}
progress_mc.resize(_local2 - 8);
loading_mc.resize(_local2 - 8);
display_mc.resize(_local2 - 12);
}
static function _setColors(force) {
var _local2;
var _local4;
if ((!force) && (!_root.setcolors)) {
return(undefined);
}
_local2 = 0;
while (_local2 < _colorKeys.length) {
if (_root[_colorKeys[_local2]] != undefined) {
_local4 = _root[_colorKeys[_local2]];
if (_local4.indexOf("0x") == -1) {
_local4 = "0x" + _local4;
}
_colorScheme[_colorKeys[_local2]] = _local4;
}
_local2++;
}
_root.setcolors = 0;
var _local3 = [{target:background_mc, color:_colorScheme.bg}, {target:volume_mc.background_mc, color:_colorScheme.leftbg}, {target:volume_mc.icon_mc, color:_colorScheme.lefticon}, {target:volume_mc.control_mc.track_mc, color:_colorScheme.voltrack}, {target:volume_mc.control_mc.bar_mc, color:_colorScheme.volslider}, {target:control_mc.background_mc.normal_mc, color:_colorScheme.rightbg}, {target:control_mc.background_mc.hover_mc, color:_colorScheme.rightbghover}, {target:control_mc.play_mc.normal_mc, color:_colorScheme.righticon}, {target:control_mc.play_mc.hover_mc, color:_colorScheme.righticonhover}, {target:control_mc.pause_mc.normal_mc, color:_colorScheme.righticon}, {target:control_mc.pause_mc.hover_mc, color:_colorScheme.righticonhover}, {target:loading_mc.bar_mc, color:_colorScheme.loader}, {target:loading_mc.track_mc, color:_colorScheme.track}, {target:progress_mc.track_mc, color:_colorScheme.track}, {target:progress_mc.bar_mc, color:_colorScheme.tracker}, {target:progress_mc.border_mc, color:_colorScheme.border}, {target:next_mc, color:_colorScheme.skip}, {target:previous_mc, color:_colorScheme.skip}, {target:display_mc.message_txt, color:_colorScheme.text}, {target:display_mc.time_txt, color:_colorScheme.text}];
var _local5;
_local2 = 0;
while (_local2 < _local3.length) {
if (typeof(_local3[_local2].target) == "movieclip") {
_local5 = new Color(_local3[_local2].target);
_local5.setRGB(_local3[_local2].color);
} else {
_local3[_local2].target.textColor = _local3[_local2].color;
}
_local2++;
}
}
static function onResize() {
_alignAndResize();
}
static function onPlay(trackIndex) {
_player.play(trackIndex, false);
if (flash.external.ExternalInterface.available) {
flash.external.ExternalInterface.call("AudioPlayer.activate", _options.playerID, _player.getState());
}
var _local1 = _player.getState();
forward("PLAY", _local1.trackInfo);
volume_mc.toggleControl(true);
if ((_state < OPENING) && (_options.animation)) {
openPlayer();
}
}
static function onStop() {
if (_options.animation && (_state > CLOSING)) {
closePlayer();
}
volume_mc.toggleControl(false);
if (control_mc.state == "pause") {
control_mc.toggle();
}
forward("STOP");
}
static function onPause() {
if (flash.external.ExternalInterface.available) {
flash.external.ExternalInterface.call("AudioPlayer.onStop", _options.playerID);
}
_player.pause();
volume_mc.toggleControl(false);
if ((_state > CLOSING) && (_options.animation)) {
closePlayer();
}
forward("PAUSE");
}
static function onMoveHead(newPosition) {
_player.moveHead(newPosition);
}
static function onSetVolume(volume, final) {
if (final == undefined) {
final = true;
}
_player.setVolume(volume, final);
if (flash.external.ExternalInterface.available && (final)) {
flash.external.ExternalInterface.call("AudioPlayer.syncVolumes", _options.playerID, volume);
}
}
static function onMetaData() {
var _local1 = _player.getState();
forward("METADATA", _local1.trackInfo);
}
static function openPlayer() {
_state = OPENING;
var _local1 = (_options.rtl ? 0 : (Stage.width - control_mc.realWidth));
if (_clearID != null) {
clearInterval(_clearID);
}
_clearID = setInterval(_animate, 40, _local1);
}
static function closePlayer() {
_state = CLOSING;
display_mc._visible = false;
var _local1 = (_options.rtl ? ((volume_mc._x - control_mc.realWidth) + 6) : (volume_mc.realWidth - 6));
if (_clearID != null) {
clearInterval(_clearID);
}
_clearID = setInterval(_animate, 40, _local1);
}
static function _animate(targetX) {
var _local1 = targetX - control_mc._x;
var _local2 = 0.5;
_local1 = _local1 * _local2;
if (Math.abs(_local1) < 1) {
control_mc._x = targetX;
if (_options.rtl) {
mask_mc._width = mask_mc._width - (_local1 * 2);
} else {
mask_mc._width = mask_mc._width + (_local1 * 2);
}
clearInterval(_clearID);
if (_state == OPENING) {
display_mc._visible = true;
_state = OPEN;
} else {
_state = CLOSED;
}
return(undefined);
}
control_mc._x = control_mc._x + _local1;
if (_options.rtl) {
mask_mc._width = mask_mc._width - _local1;
} else {
mask_mc._width = mask_mc._width + _local1;
}
}
static function _update() {
_setColors(false);
if (_options.demomode) {
return(undefined);
}
var _local1 = _player.getState();
volume_mc.update(_local1.volume);
control_mc.enabled = true;
if (_local1.state != net.onepixelout.audio.Player.PAUSED) {
progress_mc.updateProgress(_local1.played);
}
progress_mc.setMaxValue(_local1.loaded);
loading_mc.update(_local1.loaded);
if (_local1.trackCount > 1) {
next_mc.enabled = _local1.hasNext;
previous_mc.enabled = _local1.hasPrevious;
if (_local1.hasNext) {
next_mc._alpha = 100;
} else {
next_mc._alpha = 50;
}
if (_local1.hasPrevious) {
previous_mc._alpha = 100;
} else {
previous_mc._alpha = 50;
}
}
var _local3 = "";
switch (_local1.state) {
case net.onepixelout.audio.Player.NOTFOUND :
if (_local1.trackCount > 1) {
_local3 = (_local1.trackIndex + 1) + " - ";
}
display_mc.setText(_local3 + "File not found", 0);
display_mc.setTime(0);
break;
default :
var _local2 = "";
if (_local1.connecting) {
_local2 = "Connecting...";
} else {
if ((!_options.noinfo) && (_local1.trackCount > 1)) {
_local2 = (_local1.trackIndex + 1) + ": ";
}
if (_local1.buffering) {
_local2 = _local2 + "Buffering...";
} else if (!_options.noinfo) {
if ((_local1.trackInfo.artist.length > 0) || (_local1.trackInfo.title.length > 0)) {
if (_local1.trackInfo.artist.length > 0) {
_local2 = _local2 + (_local1.trackInfo.artist + " - ");
}
_local2 = _local2 + _local1.trackInfo.title;
} else {
_local2 = "Track #" + (_local1.trackIndex + 1);
}
}
}
display_mc.setText(_local2, 0, true);
display_mc.setTime((_options.remaining ? (_local1.duration - _local1.position) : (_local1.position)), _options.remaining);
}
}
static function _sixBitDecode(sourceStr) {
var _local4 = "";
var _local7 = "";
var _local8 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
var _local2;
var _local5;
var _local3;
var _local1;
_local1 = 0;
while (_local1 < sourceStr.length) {
_local2 = _local8.indexOf(sourceStr.substr(_local1, 1));
_local3 = ("000000" + _local2.toString(2)).substr(-6, 6);
_local4 = _local4 + _local3;
_local1++;
}
_local1 = 0;
while (_local1 < _local4.length) {
_local3 = _local4.substr(_local1, 8);
_local2 = parseInt(_local3, 2);
_local5 = String.fromCharCode(_local2);
_local7 = _local7 + _local5;
_local1 = _local1 + 8;
}
return(_local7);
}
static function ei_closePlayer() {
var _local1 = _player.getState();
if ((_local1.state == net.onepixelout.audio.Player.PLAYING) || (_local1.state == net.onepixelout.audio.Player.NOTFOUND)) {
if ((_local1.loaded < 1) || (_options.killdownload)) {
_player.stop(false);
} else {
_player.pause();
}
onStop();
}
}
static function ei_openPlayer(trackIndex) {
if (_state == CLOSED) {
control_mc.toggle();
}
onPlay(trackIndex);
}
static function ei_setVolume(newVolume) {
_player.setVolume(newVolume);
}
static function ei_loadFile(sourceFile, titles, artists) {
_player.stop(false);
onStop();
_player.loadPlaylist(sourceFile, titles, artists);
}
static function addJSListener(typ, fcn) {
var _local1 = typ.toUpperCase();
listeners.push({type:_local1, callee:fcn});
return(true);
}
static function removeJSListener(typ, fcn) {
var _local1 = 0;
while (_local1 < listeners.length) {
if ((listeners[_local1].type == typ) && (listeners[_local1].callee == fcn)) {
listeners.splice(_local1, 1);
return(undefined);
}
_local1++;
}
return(undefined);
}
static function forward(typ, dat) {
if (!dat) {
dat = new Object();
}
dat.playerID = _options.playerID;
for (var _local3 in listeners) {
if (listeners[_local3].type == typ) {
flash.external.ExternalInterface.call(listeners[_local3].callee, dat);
}
}
}
static var CLOSED = 0;
static var CLOSING = 1;
static var OPENING = 2;
static var OPEN = 3;
static var _colorKeys = ["bg", "leftbg", "lefticon", "voltrack", "volslider", "rightbg", "rightbghover", "righticon", "righticonhover", "text", "track", "border", "loader", "tracker", "skip"];
static var _colorScheme = {bg:15066597, leftbg:13421772, lefticon:3355443, voltrack:15921906, volslider:6710886, rightbg:11842740, rightbghover:10066329, righticon:3355443, righticonhover:16777215, skip:6710886, text:3355443, track:16777215, border:13421772, loader:39168, tracker:14540253};
static var _options = {playerID:"", encode:false, autostart:false, loop:false, animation:true, remaining:false, noinfo:false, killdownload:false, checkpolicy:false, demomode:false, bufferTime:5, volume:60, rtl:false};
static var listeners = [];
}
Symbol 44 MovieClip [__Packages.net.onepixelout.audio.Player] Frame 0
class net.onepixelout.audio.Player
{
var _volume, _state, _clearID, _duration, _position, _loaded, _played, _isBuffering, _isConnecting, _recordedPosition, _startPlaying, _lastPosition, _playCounter, _playlist, broadcastMessage, _playhead, _fadeVolume, _fadeClearID, _delayID;
function Player (options) {
AsBroadcaster.initialize(this);
if (options != undefined) {
_setOptions(options);
}
_volume = _options.initialVolume;
_state = STOPPED;
_reset();
_clearID = setInterval(this, "_watch", 50);
}
function _setOptions(options) {
for (var _local3 in options) {
_options[_local3] = options[_local3];
}
}
function _reset() {
_duration = 0;
_position = 0;
_loaded = 0;
_played = 0;
_isBuffering = false;
_isConnecting = false;
_recordedPosition = 0;
_startPlaying = false;
_lastPosition = 0;
_playCounter = 0;
}
function play(trackIndex, broadcast) {
if ((_state == PLAYING) && (_playlist.getCurrentIndex() == trackIndex)) {
return(undefined);
}
if (broadcast == undefined) {
broadcast = true;
}
if (broadcast) {
broadcastMessage("onPlay");
}
if (((_playlist.length > 1) && (trackIndex != undefined)) && (_playlist.getCurrentIndex() != trackIndex)) {
stop(false);
var _local3 = _playlist.getAtPosition(trackIndex);
} else {
var _local3 = _playlist.getCurrent();
}
_playhead = _local3.load(_options.checkPolicy);
_setBufferTime(_recordedPosition);
if (_playhead.onSoundComplete == undefined) {
_playhead.onSoundComplete = mx.utils.Delegate.create(this, next);
}
if (_state == STOPPED) {
_isConnecting = true;
}
_state = PLAYING;
setVolume();
_playhead.start(Math.floor(_recordedPosition / 1000));
_updateStats();
}
function pause() {
if (_state == PAUSED) {
play();
return(undefined);
}
if (_state < PLAYING) {
return(undefined);
}
_fadeVolume = _volume;
_fadeClearID = setInterval(this, "_fadeOut", 50);
_state = PAUSED;
}
function stop(broadcast) {
if (broadcast == undefined) {
broadcast = true;
}
if (broadcast) {
broadcastMessage("onStop");
}
_playhead.stop();
getCurrentTrack().unLoad();
_playhead = null;
_state = STOPPED;
_reset();
}
function moveHead(newHeadPosition) {
if (_state < PAUSED) {
return(undefined);
}
var _local2 = _duration * newHeadPosition;
if (_state == PAUSED) {
_recordedPosition = _local2;
} else {
_playhead.stop();
_setBufferTime(_local2);
_playhead.start(Math.floor(_local2 / 1000));
}
_updateStats();
}
function next() {
var _local2 = (_state == PLAYING) || (_state == NOTFOUND);
if ((_playlist.next() != null) && (_local2)) {
stop(false);
play();
} else {
stop(true);
}
}
function previous() {
var _local2 = _state == PLAYING;
if ((_playlist.previous() != null) && (_local2)) {
stop(false);
play();
} else {
stop(false);
}
}
function setVolume(newVolume, broadcast) {
clearInterval(_delayID);
if (newVolume != undefined) {
_volume = newVolume;
}
if (_state > STOPPED) {
_playhead.setVolume(_volume);
}
}
function getState() {
var _local2 = new Object();
_local2.state = _state;
_local2.buffering = _isBuffering;
_local2.connecting = _isConnecting;
_local2.loaded = _loaded;
_local2.played = _played;
_local2.duration = _duration;
_local2.position = _position;
_local2.volume = _volume;
_local2.trackIndex = _playlist.getCurrentIndex();
_local2.hasNext = _playlist.hasNext();
_local2.hasPrevious = _playlist.hasPrevious();
_local2.trackCount = _playlist.length;
_local2.trackInfo = getCurrentTrack().getInfo();
return(_local2);
}
function _fadeOut() {
_fadeVolume = _fadeVolume - 20;
if (_fadeVolume <= 20) {
clearInterval(_fadeClearID);
_recordedPosition = _playhead.position;
_playhead.stop();
} else {
_playhead.setVolume(_fadeVolume);
}
}
function _updateStats() {
if ((_state > STOPPED) && (_playhead.getBytesTotal() > 0)) {
_isConnecting = false;
var _local2 = getCurrentTrack();
if (_local2.isFullyLoaded()) {
_loaded = 1;
_duration = _playhead.duration;
} else {
_loaded = _playhead.getBytesLoaded() / _playhead.getBytesTotal();
if (_loaded == 1) {
_duration = _playhead.duration;
} else if (_playhead.id3.TLEN != undefined) {
_duration = parseInt(_playhead.id3.TLEN);
} else {
_duration = (1 / _loaded) * _playhead.duration;
}
}
if (_playhead.position > 0) {
_position = _playhead.position;
_played = _position / _duration;
}
if ((!_local2.isID3Loaded()) && (_playhead.id3.songname.length > 0)) {
_local2.setInfo();
broadcastMessage("onMetaData");
}
}
}
function _watch() {
var _local2 = getCurrentTrack();
if ((_state > NOTFOUND) && (!_local2.exists())) {
_reset();
_state = NOTFOUND;
return(undefined);
}
_updateStats();
if (_state == PLAYING) {
if ((++_playCounter) == 2) {
_playCounter = 0;
_isBuffering = _position == _lastPosition;
_lastPosition = _position;
}
}
}
function isBuffering() {
return(_isBuffering);
}
function isConnecting() {
return(_isConnecting);
}
function _setBufferTime(newPosition) {
if (getCurrentTrack().isFullyLoaded()) {
_root._soundbuftime = 0;
return(undefined);
}
var _local3 = Math.round(((_loaded * _duration) - newPosition) / 1000);
if (_local3 >= _options.bufferTime) {
_root._soundbuftime = 0;
} else {
_root._soundbuftime = _options.bufferTime - _local3;
}
}
function loadPlaylist(trackFileList, titleList, artistList) {
_playlist = new net.onepixelout.audio.Playlist(_options.enableCycling);
_playlist.loadFromList(trackFileList, titleList, artistList);
_reset();
}
function getTrackCount() {
return(_playlist.length);
}
function getCurrentTrack() {
return(_playlist.getCurrent());
}
static var NOTFOUND = -1;
static var STOPPED = 1;
static var PAUSED = 2;
static var PLAYING = 3;
var _options = {playerID:"", initialVolume:60, enableCycling:true, syncVolumes:true, checkPolicy:false, bufferTime:5};
}
Symbol 45 MovieClip [__Packages.net.onepixelout.audio.Playlist] Frame 0
class net.onepixelout.audio.Playlist
{
var _tracks, _currentTrackIndex, length;
function Playlist (enableCycling) {
_tracks = new Array();
_currentTrackIndex = 0;
length = 0;
if (enableCycling != undefined) {
_cyclingEnabled = enableCycling;
}
}
function loadFromList(trackList, titleList, artistList) {
var _local4 = trackList.split(",");
if (titleList == undefined) {
titleList = "";
}
if (artistList == undefined) {
artistList = "";
}
var _local6 = ((titleList.length == 0) ? (new Array()) : (titleList.split(",")));
var _local5 = ((artistList.length == 0) ? (new Array()) : (artistList.split(",")));
var _local3;
var _local2 = 0;
while (_local2 < _local4.length) {
_local3 = new net.onepixelout.audio.Track(_local4[_local2]);
if (_local2 < _local6.length) {
_local3.setTitle(_local6[_local2]);
}
if (_local2 < _local5.length) {
_local3.setArtist(_local5[_local2]);
}
addTrack(_local3);
_local2++;
}
}
function loadFromXML(listXML) {
var _local3 = listXML.firstChild.childNodes;
var _local2 = 0;
while (_local2 < _local3.length) {
addTrack(new net.onepixelout.audio.Track(_getNodeValue(_local3[_local2], "src"), _getNodeValue(_local3[_local2], "title"), _getNodeValue(_local3[_local2], "artist")));
_local2++;
}
}
function _getNodeValue(root, nodeName) {
nodeName = nodeName.toLowerCase();
var _local1 = 0;
while (root.childNodes.length) {
if (root.childNodes[_local1].nodeName.toLowerCase() == nodeName) {
return(root.childNodes[_local1].firstChild.nodeValue);
}
_local1++;
}
return(null);
}
function getCurrent() {
return(_tracks[_currentTrackIndex]);
}
function getCurrentIndex() {
return(_currentTrackIndex);
}
function hasNext() {
return(_currentTrackIndex < (length - 1));
}
function next() {
if (hasNext()) {
return(_tracks[++_currentTrackIndex]);
}
if (_cyclingEnabled) {
_currentTrackIndex = 0;
return(_tracks[0]);
}
return(null);
}
function hasPrevious() {
return(_currentTrackIndex > 0);
}
function previous() {
if (hasPrevious()) {
return(_tracks[--_currentTrackIndex]);
}
if (_cyclingEnabled) {
_currentTrackIndex = length - 1;
return(_tracks[_currentTrackIndex]);
}
return(null);
}
function getAtPosition(position) {
if ((position >= 0) && (position < length)) {
_currentTrackIndex = position;
return(_tracks[position]);
}
return(null);
}
function addTrack(track) {
_tracks.push(track);
length = _tracks.length;
}
function removeAt(position) {
_tracks.splice(position, 1);
length = _tracks.length;
}
static var _cyclingEnabled = true;
}
Symbol 46 MovieClip [__Packages.net.onepixelout.audio.Track] Frame 0
class net.onepixelout.audio.Track
{
var _soundObject, _src, _isLoaded, _isFullyLoaded, _id3Loaded, _notFound, _id3Tags;
function Track (src, title, artist) {
_soundObject = new Sound();
_src = src;
_isLoaded = false;
_isFullyLoaded = false;
_id3Loaded = false;
_notFound = false;
_id3Tags = {};
_id3Tags.location = _src;
_id3Tags.title = title;
_id3Tags.artist = artist;
}
function setTitle(title) {
_id3Tags.title = title;
}
function setArtist(artist) {
_id3Tags.artist = artist;
}
function load(checkPolicy) {
if (!_isLoaded) {
_soundObject.onLoad = mx.utils.Delegate.create(this, function (success) {
this._notFound = !success;
this._isFullyLoaded = success;
});
_soundObject.checkPolicyFile = checkPolicy;
_soundObject.loadSound(_src, true);
_isLoaded = true;
}
return(_soundObject);
}
function unLoad() {
if (!_isFullyLoaded) {
delete _soundObject;
_isLoaded = false;
_soundObject = new Sound();
}
}
function isFullyLoaded() {
return(_isFullyLoaded);
}
function isLoaded() {
return(_isLoaded);
}
function exists() {
return(!_notFound);
}
function isID3Loaded() {
return(_id3Loaded);
}
function setInfo() {
_id3Tags.album = _soundObject.id3.album;
if (_id3Tags.title == undefined) {
_id3Tags.title = _soundObject.id3.songname;
}
if (_id3Tags.artist == undefined) {
_id3Tags.artist = _soundObject.id3.artist;
}
_id3Loaded = true;
}
function getInfo() {
return(_id3Tags);
}
}
Symbol 47 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 48 MovieClip [__Packages.Progress] Frame 0
class Progress extends MovieClip
{
var bar_mc, _movingHead, track_mc, _maxPos, border_mc, _xmouse;
function Progress () {
super();
AsBroadcaster.initialize(this);
bar_mc._width = 0;
_movingHead = false;
track_mc.onPress = mx.utils.Delegate.create(this, function () {
this._movingHead = true;
this._moveProgressBar();
});
track_mc.onMouseMove = mx.utils.Delegate.create(this, function () {
if (this._movingHead) {
this._moveProgressBar();
}
});
track_mc.onRelease = (track_mc.onReleaseOutside = mx.utils.Delegate.create(this, function () {
this.broadcastMessage("onMoveHead", this.bar_mc._width / this.track_mc._width);
this._movingHead = false;
}));
}
function updateProgress(played) {
if (!_movingHead) {
bar_mc._width = Math.round(played * track_mc._width);
}
}
function setMaxValue(maxValue) {
_maxPos = maxValue * track_mc._width;
}
function resize(newWidth) {
track_mc._width = newWidth - 2;
border_mc._width = newWidth;
}
function _moveProgressBar() {
var _local2 = _xmouse - 1;
if (_local2 < 0) {
_local2 = 0;
} else if (_local2 > _maxPos) {
_local2 = _maxPos;
}
bar_mc._width = _local2;
}
}
Symbol 49 MovieClip [__Packages.Loading] Frame 0
class Loading extends MovieClip
{
var bar_mc, track_mc;
function Loading () {
super();
bar_mc._width = 0;
}
function update(loaded) {
bar_mc._width = Math.round(loaded * track_mc._width);
}
function resize(newWidth) {
var _local2 = newWidth / track_mc._width;
track_mc._width = newWidth;
bar_mc._width = bar_mc._width * _local2;
}
}
Symbol 50 MovieClip [__Packages.Control] Frame 0
class Control extends MovieClip
{
var state, pause_mc, play_mc, realWidth, background_mc, broadcastMessage;
function Control () {
super();
AsBroadcaster.initialize(this);
if (state == "play") {
pause_mc._visible = false;
} else {
play_mc._visible = false;
}
realWidth = background_mc._width;
background_mc.hover_mc._visible = (play_mc.hover_mc._visible = (pause_mc.hover_mc._visible = false));
}
function onRollOver() {
_switch(true);
}
function onRollOut() {
_switch(false);
}
function onReleaseOutside() {
_switch(false);
}
function onRelease() {
toggle(true);
}
function _switch(toggle) {
if (state == "play") {
play_mc.hover_mc._visible = toggle;
}
if (state == "pause") {
pause_mc.hover_mc._visible = toggle;
}
background_mc.hover_mc._visible = toggle;
}
function toggle(broadcast) {
if (broadcast == undefined) {
broadcast = false;
}
if (state == "play") {
if (broadcast) {
broadcastMessage("onPlay");
}
play_mc._visible = false;
play_mc.hover_mc._visible = false;
pause_mc._visible = true;
state = "pause";
} else {
if (broadcast) {
broadcastMessage("onPause");
}
pause_mc._visible = false;
pause_mc.hover_mc._visible = false;
play_mc._visible = true;
state = "play";
}
}
function flip() {
background_mc._rotation = 180;
background_mc._y = background_mc._height;
background_mc._x = background_mc._width;
play_mc._x = 14;
pause_mc._x = 13;
}
}
Symbol 51 MovieClip [__Packages.Display] Frame 0
class Display extends MovieClip
{
var _messages, _currentSlot, _ticker, message_txt, time_txt, _newWidth;
function Display () {
super();
_messages = new Array();
_currentSlot = 0;
_ticker = new Ticker(message_txt);
_ticker.start();
}
function next() {
_currentSlot = (((++_currentSlot) == _messages.length) ? 0 : (_currentSlot));
_update();
}
function setText(text, slot, forceDisplay) {
if (forceDisplay == undefined) {
forceDisplay = false;
}
var _local3 = false;
if ((_currentSlot == slot) && (_messages[slot] != text)) {
_local3 = true;
}
if (forceDisplay && (_messages[slot] != text)) {
_currentSlot = slot;
_local3 = true;
}
_messages[slot] = text;
if (_local3) {
_update();
}
}
function setTime(ms, isRemaining) {
var _local2 = ((isRemaining && (ms > 0)) ? "-" : "");
time_txt.text = _local2 + _formatTime(ms);
resize();
}
function clear() {
_messages = new Array();
_currentSlot = 0;
message_txt.text = "";
time_txt.text = "";
_ticker.reset();
}
function resize(newWidth) {
if (newWidth != undefined) {
_newWidth = newWidth;
}
var _local2 = _newWidth;
_local2 = _local2 - ((time_txt.text.length > 5) ? 50 : 38);
message_txt._width = _local2;
time_txt._x = (_newWidth - time_txt._width) + 1;
}
function _update() {
message_txt.text = _messages[_currentSlot];
_ticker.reset();
}
function _formatTime(ms) {
var _local2 = new Date();
var _local3;
var _local4;
var _local5;
var _local1;
_local2.setSeconds(int(ms / 1000));
_local2.setMinutes(int((ms / 1000) / 60));
_local2.setHours(int(((ms / 1000) / 60) / 60));
_local3 = _local2.getSeconds();
_local4 = _local2.getMinutes();
_local5 = _local2.getHours();
_local1 = _local3.toString();
if (_local3 < 10) {
_local1 = "0" + _local1;
}
_local1 = ":" + _local1;
_local1 = _local4.toString() + _local1;
if (_local5 > 0) {
if (_local4 < 10) {
_local1 = "0" + _local1;
}
_local1 = ":" + _local1;
_local1 = _local5.toString() + _local1;
}
return(_local1);
}
}
Symbol 52 MovieClip [__Packages.Ticker] Frame 0
class Ticker
{
var _direction, _textField, _clearID, _options;
function Ticker (textField, options) {
_direction = "fw";
_textField = textField;
_clearID = null;
_options = {pause:6000, interval:25, increment:1};
if (typeof(options) == "Object") {
setOptions(options);
}
}
function setOptions(options) {
for (var _local3 in options) {
_options[_local3] = options[_local3];
}
}
function start() {
_clearID = setInterval(this, "_start", _options.pause);
}
function reset() {
clearInterval(_clearID);
_textField.hscroll = 0;
start();
}
function _start() {
if (_textField.maxhscroll == 0) {
return(undefined);
}
clearInterval(_clearID);
_clearID = setInterval(this, "_scroll", _options.interval);
}
function _scroll() {
if ((_direction == "fw") && (_textField.hscroll == _textField.maxhscroll)) {
_direction = "bw";
clearInterval(_clearID);
_clearID = setInterval(this, "_start", _options.pause);
return(undefined);
}
if ((_direction == "bw") && (_textField.hscroll == 0)) {
_direction = "fw";
clearInterval(_clearID);
_clearID = setInterval(this, "_start", _options.pause);
return(undefined);
}
if (_direction == "fw") {
_textField.hscroll = _textField.hscroll + _options.increment;
} else {
_textField.hscroll = _textField.hscroll - _options.increment;
}
}
}
Symbol 53 MovieClip [__Packages.Volume] Frame 0
class Volume extends MovieClip
{
var control_mc, button_mc, icon_mc, _settingVolume, _initialMaskPos, realWidth, background_mc, _clearID;
function Volume () {
super();
AsBroadcaster.initialize(this);
control_mc._alpha = 0;
button_mc._visible = false;
icon_mc._alpha = 100;
_settingVolume = false;
_initialMaskPos = control_mc.mask_mc._x;
realWidth = background_mc._width;
button_mc.onPress = mx.utils.Delegate.create(this, function () {
this._settingVolume = true;
this._moveVolumeBar();
});
button_mc.onMouseMove = mx.utils.Delegate.create(this, function () {
if (this._settingVolume) {
this._moveVolumeBar();
this.broadcastMessage("onSetVolume", this._getValue(), false);
}
});
button_mc.onRelease = (button_mc.onReleaseOutside = mx.utils.Delegate.create(this, function () {
this._settingVolume = false;
this._moveVolumeBar();
this.broadcastMessage("onSetVolume", this._getValue(), true);
}));
}
function update(volume) {
if (!_settingVolume) {
control_mc.mask_mc._x = _initialMaskPos + Math.round((control_mc.track_mc._width * volume) / 100);
}
}
function _moveVolumeBar() {
if (control_mc.track_mc._xmouse > control_mc.track_mc._width) {
control_mc.mask_mc._x = _initialMaskPos + control_mc.track_mc._width;
} else if (control_mc.track_mc._xmouse < 0) {
control_mc.mask_mc._x = _initialMaskPos;
} else {
control_mc.mask_mc._x = _initialMaskPos + control_mc.track_mc._xmouse;
}
}
function _getValue() {
return(Math.round(((control_mc.mask_mc._x - _initialMaskPos) / control_mc.track_mc._width) * 100));
}
function toggleControl(toggle, immediate) {
clearInterval(_clearID);
if (toggle) {
_clearID = setInterval(this, "_animate", 41, 100, 0, (_rtl ? 11 : 6));
} else {
_clearID = setInterval(this, "_animate", 41, 0, 100, (_rtl ? 21 : 16));
}
}
function _animate(targetControl, targetIcon, targetIconX) {
var _local2 = targetControl - control_mc._alpha;
var _local5 = targetIcon - icon_mc._alpha;
var _local4 = targetIconX - icon_mc._x;
var _local3 = 0.3;
_local2 = _local2 * _local3;
_local5 = _local5 * _local3;
_local4 = _local4 * _local3;
if (Math.abs(_local2) < 1) {
control_mc._alpha = targetControl;
icon_mc._alpha = targetIcon;
icon_mc._x = targetIconX;
button_mc._visible = control_mc._alpha == 100;
clearInterval(_clearID);
return(undefined);
}
control_mc._alpha = control_mc._alpha + _local2;
icon_mc._alpha = icon_mc._alpha + _local5;
icon_mc._x = icon_mc._x + _local4;
}
function flip() {
_rtl = true;
background_mc._rotation = 180;
background_mc._y = background_mc._height;
background_mc._x = background_mc._width;
control_mc._x = control_mc._x + 2;
icon_mc._x = icon_mc._x + 2;
}
var _rtl = false;
}