Frame 1
Instance of Symbol 18 MovieClip [countdown_mc] "countdown_mc" in Frame 1
on (release) {
getURL ("http://www.justsayhi.com/bb/countdown");
}
Frame 2
d = new Date();
if (!yr) {
yr = d.getFullYear();
jump = true;
}
if (!mo) {
mo = 12;
}
if (!da) {
da = 25;
}
if (!ho) {
ho = 0;
}
if (!mi) {
mi = 0;
}
if (!un) {
un = "CHRISTMAS";
}
if (typeof(co) != "undefined") {
co = String(co);
} else {
co = "0099FF";
}
if (typeof(sc) != "undefined") {
sc = String(sc);
} else {
sc = "";
}
if (jump != true) {
jump = false;
}
countdown_mc.startCountdown(yr, mo, da, ho, mi, jump, sc, co, snd, un);
stop();
Symbol 18 MovieClip [countdown_mc] Frame 1
var d0;
var d1;
var d2;
var h0;
var h1;
var m0;
var m1;
var s0;
var s1;
var yr;
var mo;
var da;
var ho;
var mi;
var un;
var nextYear;
var timeScript;
var now_date;
var load_xml;
var isSound;
var tick_sound = new Sound();
tick_sound.attachSound("tick");
tick_sound.setVolume(25);
startCountdown = function (yr, mo, da, ho, mi, nextYear, timeScript, color, snd, un) {
d0_txt.textColor = Number("0x" + color);
d1_txt.textColor = Number("0x" + color);
d2_txt.textColor = Number("0x" + color);
h0_txt.textColor = Number("0x" + color);
h1_txt.textColor = Number("0x" + color);
m0_txt.textColor = Number("0x" + color);
m1_txt.textColor = Number("0x" + color);
s0_txt.textColor = Number("0x" + color);
s1_txt.textColor = Number("0x" + color);
un0_txt.textColor = Number("0x" + color);
this.yr = yr;
this.mo = mo;
this.da = da;
this.ho = ho;
this.mi = mi;
this.un = un;
un0_txt.text = "UNTIL " + un;
this.nextYear = nextYear;
this.timeScript = timeScript;
this.isSound = (snd.length ? true : false);
getCurrentTime();
};
getCurrentTime = function () {
if (this.timeScript == "") {
this.now_date = new Date();
checkMSecsRemaining();
} else {
trace("loadXML");
load_xml = new XML();
load_xml.ignoreWhite = true;
load_xml.onLoad = function (success) {
if (success) {
var _local2 = Number(this.firstChild.firstChild.firstChild.nodeValue) * 1000;
now_date = new Date(_local2);
checkMSecsRemaining();
}
};
load_xml.load(this.timeScript);
}
};
checkMSecsRemaining = function () {
startMSecsRemaining = getMSecsRemaining(yr, mo, da, ho, mi);
if (startMSecsRemaining) {
setControlMC();
} else {
setDisplay();
}
};
setControlMC = function () {
this.createEmptyMovieClip("control_mc", 0);
control_mc.onEnterFrame = function () {
this._parent.setDisplay();
};
};
getMSecsRemaining = function (year, mon, day, hour, min) {
if (!year) {
year = now_date.getFullYear();
}
var _local2 = new Date(year, mon - 1, day, hour, min);
if ((_local2.getTime() < now_date.getTime()) && (!this.nextYear)) {
return(0);
}
while (_local2.getTime() < now_date.getTime()) {
_local2.setYear(Number(_local2.getFullYear()) + 1);
}
return(Math.floor(_local2.getTime() - now_date.getTime()));
};
getMSecsElapsed = function () {
return(Math.floor(getTimer()));
};
setChar = function (part, val) {
if (this[part] != val) {
this[part + "_txt"].text = (this[part] = val);
if (((part == "s1") && (tick_sound.getVolume())) && (isSound)) {
tick_sound.start();
tick_sound.setVolume(tick_sound.getVolume() - 1);
}
}
};
leadingZeros = function (str, no) {
while (str.length < no) {
str = "0" + str;
}
return(str);
};
setDisplay = function () {
var _local5 = startMSecsRemaining - getMSecsElapsed();
if (_local5 > 0) {
temp_date = new Date(_local5);
var _local1 = Math.floor(_local5 / 86400000);
var _local4 = Math.floor((_local5 - (_local1 * 86400000)) / 3600000);
var _local3 = temp_date.getMinutes().toString();
var _local2 = temp_date.getSeconds().toString();
_local1 = leadingZeros(_local1.toString(), 3);
_local4 = leadingZeros(_local4.toString(), 2);
_local3 = leadingZeros(_local3, 2);
_local2 = leadingZeros(_local2, 2);
setChar("d0", _local1.charAt(0));
setChar("d1", _local1.charAt(1));
setChar("d2", _local1.charAt(2));
setChar("h0", _local4.charAt(0));
setChar("h1", _local4.charAt(1));
setChar("m0", _local3.charAt(0));
setChar("m1", _local3.charAt(1));
setChar("s0", _local2.charAt(0));
setChar("s1", _local2.charAt(1));
} else {
d0_txt.text = "0";
d1_txt.text = "0";
d2_txt.text = "0";
h0_txt.text = "0";
h1_txt.text = "0";
m0_txt.text = "0";
m1_txt.text = "0";
s0_txt.text = "0";
s1_txt.text = "0";
}
};