Frame 1
function LoadFile(file) {
trace("LoadFile:" + file);
var _local1 = _url.lastIndexOf("\\");
if (-1 == _local1) {
_local1 = _url.lastIndexOf("/");
}
g_sDir = _url.substring(0, _local1 + 1);
mcMusic.loadMovie(g_sDir + file);
trace(g_sDir + file);
nPlayFrame = 0;
var nDelay = 0;
onEnterFrame = function () {
tb = mcMusic.getBytesTotal();
lb = mcMusic.getBytesLoaded();
if (tb <= 0) {
return(undefined);
}
percent = int((lb * 100) / tb);
if (percent > nDelay) {
percent = nDelay;
}
nDelay = nDelay + 10;
if (percent < 100) {
g_Buffer = ("Buffering... " + percent) + "%";
} else {
g_Buffer = mcMusic.music;
if (mcMusic._currentframe == mcMusic._totalframes) {
if (bAutoNext) {
if (bShuffleList) {
nCur = random(nCount);
PlayIt();
} else {
PlayNext();
}
}
}
}
mc_sbox._visible = true;
Process();
};
}
function Process() {
var _local5 = mc_slot._width - (mc_slot.btn_thumb._width * 1.5);
var _local1 = int(mcMusic._totalframes / 38);
var _local2 = int(mcMusic._currentframe / 38);
var _local4 = (int(_local1 / 60) + ":") + int(_local1 % 60);
var _local6 = (int(_local2 / 60) + ":") + int(_local2 % 60);
g_Time = (_local6 + " / ") + _local4;
if (mcMusic.LRC != undefined) {
lyric = mcMusic.LRC;
}
var _local3 = (mcMusic._currentframe * _local5) / mcMusic._totalframes;
mc_slot.btn_thumb._x = _local3;
}
function PlayMusic() {
var _local1 = asFile[nCur];
mc_player.btnPlay._visible = false;
mc_player.btnPause._visible = true;
if (nPlayFrame == 0) {
LoadFile(_local1);
} else {
mcMusic.gotoAndPlay(nPlayFrame);
}
}
function PauseMusic() {
trace("PauseMusic ");
mc_player.btnPlay._visible = true;
mc_player.btnPause._visible = false;
nPlayFrame = mcMusic._currentframe;
mcMusic.stop();
}
function PlayPrev() {
trace("PlayPrev");
if (nCur == 0) {
if (bLoopList) {
nCur = nCount - 1;
}
} else {
nCur--;
}
nPlayFrame = 0;
PlayMusic();
}
function PlayNext() {
trace((((("PlayNext bLoopList" + bLoopList) + " current:") + nCur) + " count:") + nCount);
if (nCur >= (nCount - 1)) {
if (!bLoopList) {
return(undefined);
}
nCur = 0;
} else {
nCur++;
}
nPlayFrame = 0;
PlayMusic();
}
function PlayIt() {
nPlayFrame = 0;
PlayMusic();
}
function SetMusicVol(vol) {
trace("SetMusicVol:" + vol);
var _local3 = mc_player.mc_soundctrl._width - mc_player.mc_soundctrl.btn_vol._width;
var _local1 = int(((vol / _local3) * 200) + 0.5);
trace("volume: " + _local1);
var _local2 = new Sound();
_local2.setVolume(_local1);
}
function SetMusicPos(pos) {
trace("SetMusicPos:" + pos);
var _local2 = mc_slot._width - mc_slot.btn_thumb._width;
var _local1 = pos / _local2;
PauseMusic();
nPlayFrame = int(mcMusic._totalframes * _local1);
trace("nPlayFrame = mcMusic._currentframe*dPercent: " + nPlayFrame);
PlayMusic();
}
var nCur = 0;
var nCount = 0;
var bAutoStart = true;
var bAutoNext = true;
var bLoopList = true;
var bShuffleList = true;
var nPlayFrame = 0;
var asFile = new Array(100);
mc_sbox._visible = false;
var xml = new XML();
xml.load("music_list.xml");
xml.onLoad = function (success) {
xmlRoot = xml.firstChild;
var _local2 = xml.firstChild.attributes.title;
trace(_local2);
g_Title = _local2;
bAutoStart = int(xml.firstChild.attributes.autostart);
bAutoNext = int(xml.firstChild.attributes.autonext);
bLoopList = int(xml.firstChild.attributes.looplist);
bShuffleList = int(xml.firstChild.attributes.shufflelist);
trace("Loop:" + bLoopList);
node = xmlRoot.firstChild;
nCount = 0;
while (true) {
var _local1 = node.firstChild.firstChild.toString();
trace(_local1);
asFile[nCount] = _local1;
nCount++;
if (node == xmlRoot.lastChild) {
break;
}
node = node.nextSibling;
}
if (bAutoStart) {
PlayMusic();
}
};
mcMusic = createEmptyMovieClip("objMusic", 100);
Instance of Symbol 35 MovieClip "mc_slot" in Frame 1
onClipEvent (mouseDown) {
w = _width - btn_thumb._width;
if ((((_xmouse < 0) || (_xmouse > w)) || (_ymouse < 0)) || (_ymouse > _height)) {
return(undefined);
}
startDrag (btn_thumb, true, 0, 0, w, 0);
bProStart = true;
}
onClipEvent (mouseUp) {
if (!bProStart) {
return(undefined);
}
bProStart = false;
stopDrag();
_parent.SetMusicPos(_xmouse);
}
Symbol 5 Button
on (press) {
_parent.PauseMusic();
}
Symbol 8 Button
on (press) {
_parent.PlayMusic();
}
Symbol 11 Button
on (press) {
_parent.PlayPrev();
}
Symbol 14 Button
on (press) {
_parent.PlayNext();
}
Symbol 17 Button
on (press) {
if (mc_soundctrl.btn_vol._x == 0) {
mc_soundctrl.btn_vol._x = nVol;
} else {
nVol = mc_soundctrl.btn_vol._x;
mc_soundctrl.btn_vol._x = 0;
}
_parent.SetMusicVol(mc_soundctrl.btn_vol._x);
}
Instance of Symbol 20 MovieClip "mc_soundctrl" in Symbol 21 MovieClip Frame 1
onClipEvent (mouseDown) {
if ((((_xmouse < 0) || (_xmouse > _width)) || (_ymouse < 0)) || (_ymouse > _height)) {
return(undefined);
}
w = _width - btn_vol._width;
startDrag (btn_vol, true, 0, 0, w, 0);
bVolStart = true;
}
onClipEvent (mouseMove) {
if (((!bVolStart) || (_xmouse < 0)) || (_xmouse > (_width - btn_vol._width))) {
return(undefined);
}
_parent._parent.SetMusicVol(_xmouse);
}
onClipEvent (mouseUp) {
if (!bVolStart) {
return(undefined);
}
bVolStart = false;
stopDrag();
_parent._parent.SetMusicVol(_xmouse);
}
Symbol 31 MovieClip Frame 1
mc_sb0.stop();
i = 1;
while (i < 10) {
obj = mc_sb0.duplicateMovieClip("mc_sb" + i, 10 + i);
obj._x = mc_sb0._x + ((mc_sb0._width + 1) * i);
obj._y = mc_sb0._y;
obj.stop();
i++;
}
onEnterFrame = function () {
i = 0;
while (i < 10) {
objBlock = eval ("mc_sb" + i);
objS = eval ("_root.mcMusic.s" + i) * 2;
if (objS > 30) {
objS = 30;
}
objValue = objS;
objBlock.gotoAndStop(objValue);
i++;
}
};
Symbol 32 Button
on (press) {
getURL ("http://www.flashdemo.net");
}