Symbol 18 MovieClip Frame 1
stop();
Symbol 18 MovieClip Frame 2
play();
Symbol 18 MovieClip Frame 15
stop();
Symbol 18 MovieClip Frame 24
stop();
Symbol 23 MovieClip Frame 22
stop();
Symbol 34 MovieClip Frame 1
function init() {
thumb_mc._visible = false;
error_mc._visible = false;
filename = "/buzz_videos";
title_mc.content_txt.text = ((_root.t == undefined) ? "Videos being watched right now..." : (unescape(_root.t)));
home_mc = this;
startDepth = 1000;
colMax = 5;
rowCurrent = 0;
tCurrent = 0;
tHideTime = 75;
rowTimeShown = 8000;
rowMaxDisplayed = 36;
userInteracting = false;
trackMarginTop = 10;
trackMarginBottom = 5;
trackMarginSide = 10;
trackSideLeft = trackMarginSide;
trackSideRight = Stage.width - trackMarginSide;
trackSideTop = trackMarginTop;
trackSideBottom = Stage.height - trackMarginBottom;
trackXRange = Stage.width - (trackMarginSide * 2);
trackSpacing = trackXRange / colMax;
info = new Array();
pos = new Object();
pos.startP = 0.83;
pos.startX = new Array();
pos.startY = vanish_mc._y + ((showline_mc._y - vanish_mc._y) * pos.startP);
pos.showP = 0.95;
pos.showX = new Array();
pos.showY = showline_mc._y;
pos.showMargin = 6;
pos.showCtr = ((Stage.width - thumb_mc._width) - (pos.showMargin * 2)) / (colMax - 1);
pos.showTime = 12;
pos.finalP = 1.3;
pos.finalX = new Array();
pos.finalY = vanish_mc._y + ((showline_mc._y - vanish_mc._y) * pos.finalP);
pos.finalTime = 35;
pos.rollOverTime = 4;
pos.startToShowX = new Object();
pos.startToShowY = new Object();
pos.startToShowP = new Object();
fader_mc._alpha = 0;
fader_mc.swapDepths(4999);
progress_mc.swapDepths(5001);
title_mc.swapDepths(5002);
showline_mc._visible = false;
home_mc.createEmptyMovieClip("lines_mc", 1);
lines_mc._visible = false;
lines_mc.lineStyle(0, 16711935, 100);
var _local3 = 0;
while (_local3 < colMax) {
pos.showX[_local3] = (pos.showMargin + (thumb_mc._width / 2)) + (pos.showCtr * _local3);
pos.startX[_local3] = pos.showX[_local3] + ((vanish_mc._x - pos.showX[_local3]) * (1 - pos.startP));
pos.finalX[_local3] = pos.showX[_local3] + ((vanish_mc._x - pos.showX[_local3]) * (1 - pos.finalP));
lines_mc.moveTo(vanish_mc._x, vanish_mc._y);
lines_mc.lineTo(pos.showX[_local3], pos.showY);
pos.startToShowX["col" + _local3] = new Array();
pos.startToShowY["col" + _local3] = new Array();
pos.startToShowP["col" + _local3] = new Array();
var _local4 = 0;
while (_local4 <= pos.showTime) {
pos.startToShowX["col" + _local3][_local4] = easeIn(_local4, pos.startX[_local3], pos.showX[_local3] - pos.startX[_local3], pos.showTime);
pos.startToShowY["col" + _local3][_local4] = easeIn(_local4, pos.startY, pos.showY - pos.startY, pos.showTime);
pos.startToShowP["col" + _local3][_local4] = easeIn(_local4, pos.startP, pos.showP - pos.startP, pos.showTime) * 100;
_local4++;
}
_local3++;
}
intImgLoading();
loadXML(filename);
}
function hideProgress() {
progress_mc.onEnterFrame = function () {
this._alpha = this._alpha - 25;
this._xscale = this._xscale + 10;
this._yscale = this._yscale + 10;
this._y = this._y + 7;
if (this._alpha <= 0) {
progress_mc.stop();
progrees_mc._visible = false;
this.onEnterFrame = function () {
};
}
};
}
function easeIn(t, b, c, d) {
t = t / d;
return(((((c * t) * t) * t) * t) + b);
}
function easeOut(t, b, c, d) {
t = (t / d) - 1;
return(((-c) * ((((t * t) * t) * t) - 1)) + b);
}
function onXMLLoaded() {
hideProgress();
createNewRow(rowCurrent);
currentInterval = setInterval(onShowNextRow, rowTimeShown);
}
function onXMLError(error_status) {
error_mc._visible = true;
progress_mc._visible = false;
progress_mc.stop();
}
function onNewRowCreated(row) {
home_mc.createEmptyMovieClip("loadChecker_mc", home_mc.getNextHighestDepth());
home_mc.loadChecker_mc.onEnterFrame = function () {
var _local3 = true;
var _local2 = 0;
while (_local2 < colMax) {
_local3 = home_mc[(("thumb" + row) + _local2) + "_mc"].imgLoaded;
_local2++;
}
if (_local3) {
showThumbs(row);
this.onEnterFrame = function () {
};
}
};
}
function onShowThumbs(row) {
rowCurrent = row;
}
function onHideThumbs(row) {
}
function onShowNextRow() {
if (rowCurrent >= rowMaxDisplayed) {
clearInterval(currentInterval);
}
if (!userInteracting) {
createNewRow(rowCurrent + 1);
}
}
function onThumbRollOver() {
home_mc.createEmptyMovieClip("mousetracker_mc", home_mc.getNextHighestDepth());
home_mc.mousetracker_mc.current_mc = this;
home_mc.mousetracker_mc.oldX = _xmouse;
home_mc.mousetracker_mc.oldY = _ymouse;
home_mc.mousetracker_mc.onEnterFrame = function () {
if ((Math.round(_xmouse) == Math.round(this.oldX)) && (Math.round(_ymouse) == Math.round(this.oldY))) {
this.count++;
if (this.count > tHideTime) {
this.current_mc.onRollOut();
this.onEnterFrame = function () {
};
}
} else {
this.count = 0;
this.oldX = _xmouse;
this.oldY = _ymouse;
}
};
userInteracting = true;
this.swapDepths(5000);
this.active = true;
updateFadeThumbs(this.row, this.col);
this.count = 0;
this.onEnterFrame = function () {
if (this._y < (pos.showY + ((this.showIncY / 2) * pos.rollOverTime))) {
this._x = this._x + (this.showIncX / 2);
this._y = this._y + (this.showIncY / 2);
this._xscale = this._xscale + (this.showIncP / 2);
this._yscale = this._yscale + (this.showIncP / 2);
this.hitArea_mc._yscale = this.hitArea_mc._yscale + 4;
}
this.count++;
if (this.count >= pos.rollOverTime) {
this.title_mc._visible = true;
this.onEnterFrame = function () {
};
}
};
}
function onThumbRollOut() {
userInteracting = false;
this.active = false;
this.title_mc._visible = false;
updateFadeThumbs(this.row, this.col);
this.onEnterFrame = function () {
this._x = this._x - (this.showIncX / 2);
this._y = this._y - (this.showIncY / 2);
this._xscale = this._xscale - (this.showIncP / 2);
this._yscale = this._yscale - (this.showIncP / 2);
this.hitArea_mc._yscale = this.hitArea_mc._yscale - 4;
if (this._y <= pos.showY) {
this._x = pos.showX[this.col];
this._y = pos.showY;
this._xscale = pos.showP * 100;
this._yscale = pos.showP * 100;
this.onEnterFrame = function () {
};
}
};
}
function onThumbRelease() {
getURL (info[this.infoID].url);
}
function loadXML(filename) {
var data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function (success) {
if (success) {
var _local8 = data_xml.firstChild.firstChild.childNodes.length;
var _local5 = new Array();
var _local4 = new Array();
var _local7 = 0;
while (_local7 < _local8) {
_local5.push(_local7);
_local7++;
}
_local7 = 0;
while (_local7 < _local8) {
var _local6 = Math.floor(Math.random() * _local5.length);
_local4.push(_local5[_local6]);
_local5.splice(_local6, 1);
_local7++;
}
var _local3 = 0;
var _local2 = data_xml.firstChild.firstChild.firstChild;
while (_local2 != null) {
info[_local4[_local3]] = new Array();
var _local1 = _local2.firstChild;
while (_local1 != null) {
info[_local4[_local3]][_local1.nodeName] = _local1.firstChild.nodeValue;
_local1 = _local1.nextSibling;
}
_local3++;
_local2 = _local2.nextSibling;
}
if (_local3 == 0) {
onXMLError();
} else {
onXMLLoaded();
}
} else {
onXMLError(data_xml.status);
}
};
data_xml.load(filename);
}
function createNewRow(row) {
var _local2 = 0;
while (_local2 < colMax) {
duplicateMovieClip ("thumb_mc", (("thumb" + row) + _local2) + "_mc", startDepth--);
var _local1 = home_mc[(("thumb" + row) + _local2) + "_mc"];
_local1.title_mc._visible = false;
loadThumbImg(row, _local2, info[tCurrent].thumbnail_url);
_local1.infoID = tCurrent;
_local1.row = row;
_local1.col = _local2;
_local1.showIncX = (pos.showX[_local2] - pos.startX[_local2]) / pos.showTime;
_local1.showIncY = (pos.showY - pos.startY) / pos.showTime;
_local1.showIncP = ((pos.showP - pos.startP) * 100) / pos.showTime;
_local1.finalIncX = (pos.finalX[_local2] - pos.showX[_local2]) / pos.finalTime;
_local1.finalIncY = (pos.finalY - pos.showY) / pos.finalTime;
_local1.finalIncP = ((pos.finalP - pos.showP) * 100) / pos.finalTime;
_local1._x = pos.startX[_local2];
_local1._y = pos.startY;
_local1._xscale = pos.startP * 100;
_local1._yscale = pos.startP * 100;
_local1.onRelease = onThumbRelease;
_local1.onRollOver = onThumbRollOver;
_local1.onRollOut = onThumbRollOut;
_local1.enabled = false;
_local1.title_mc.content_txt.text = info[tCurrent].title;
_local1.overlay_mc.length_txt.text = info[tCurrent].run_time;
_local1.overlay_mc.viewers_txt.text = info[tCurrent].viewers;
tCurrent++;
if (tCurrent >= info.length) {
tCurrent = 0;
}
_local2++;
}
onNewRowCreated(row);
}
function showThumbs(row) {
home_mc.createEmptyMovieClip(("ctrlShow" + row) + "_mc", this.getNextHighestDepth());
if (row > 0) {
hideThumbs(row - 1);
}
home_mc[("ctrlShow" + row) + "_mc"].timer = 0;
home_mc[("ctrlShow" + row) + "_mc"].count = 0;
home_mc[("ctrlShow" + row) + "_mc"].onEnterFrame = function () {
if (Math.floor(this.timer / 3) == (this.timer / 3)) {
var _local2 = home_mc[(("thumb" + row) + this.count) + "_mc"];
_local2.count = 0;
_local2.onEnterFrame = function () {
this._x = pos.startToShowX["col" + this.col][this.count];
this._y = pos.startToShowY["col" + this.col][this.count];
this._xscale = pos.startToShowP["col" + this.col][this.count];
this._yscale = this._xscale;
this.count++;
if (this.count > pos.showTime) {
this.enabled = true;
this.onEnterFrame = function () {
};
}
};
_local2.gotoAndPlay("show");
if ((this.count++) >= colMax) {
onShowThumbs(row);
this.onEnterFrame = function () {
};
}
}
this.timer++;
};
}
function hideThumbs(row) {
var _local3 = 0;
while (_local3 < colMax) {
var _local2 = home_mc[(("thumb" + row) + _local3) + "_mc"];
_local2.enabled = false;
_local2.count = 0;
_local2.onEnterFrame = function () {
this._x = this._x + this.finalIncX;
this._y = this._y + this.finalIncY;
this._xscale = this._xscale + this.finalIncP;
this._yscale = this._yscale + this.finalIncP;
this.count++;
if (this.count >= pos.finalTime) {
if (this.col == 0) {
killAllOldThumbs();
}
this._visible = false;
this.removeMovieClip();
this.onEnterFrame = function () {
};
}
};
_local2.gotoAndPlay("hide");
_local3++;
}
}
function killAllOldThumbs() {
var _local3 = rowCurrent - 1;
var _local2 = 0;
while (_local2 < colMax) {
var _local1 = home_mc[(("thumb" + _local3) + _local2) + "_mc"];
if (_local1._x != undefined) {
_local1.enabled = false;
_local1._visible = false;
_local1.removeMovieClip();
}
_local2++;
}
}
function updateFadeThumbs(row, col) {
var _local3 = false;
var _local2 = 0;
while (_local2 < colMax) {
if (home_mc[(("thumb" + row) + _local2) + "_mc"].active) {
_local3 = true;
break;
}
_local2++;
}
if (_local3) {
fader_mc.onEnterFrame = function () {
if (this._alpha <= 30) {
this._alpha = this._alpha + 5;
} else {
this._alpha = 30;
this.onEnterFrame = function () {
};
}
};
} else {
fader_mc.count = 0;
fader_mc.onEnterFrame = function () {
if (this._alpha > 5) {
if (this.count > 5) {
this._alpha = this._alpha - 10;
}
} else {
this._alpha = 0;
this.onEnterFrame = function () {
};
}
this.count++;
};
}
}
function intImgLoading() {
var _local1 = new Object();
_local1.onLoadStart = function (target_mc) {
};
_local1.onLoadComplete = function (target_mc) {
};
_local1.onLoadError = function (target_mc, errorCode, httpStatus) {
};
_local1.onLoadInit = function (target_mc) {
target_mc._xscale = ((home_mc.thumb_mc.main_mc._width - 4) / target_mc._width) * 100;
target_mc._yscale = target_mc._xscale;
target_mc._x = target_mc._width / -2;
target_mc._y = -target_mc._height;
target_mc._parent._parent.imgLoaded = true;
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(_local1);
}
function loadThumbImg(row, col, filename) {
var current_mc = home_mc[(("thumb" + row) + col) + "_mc"];
current_mc.main_mc.createEmptyMovieClip("imgHolder_mc", current_mc.main_mc.getNextHighestDepth());
current_mc.reflection_mc.createEmptyMovieClip("imgHolder_mc", current_mc.main_mc.getNextHighestDepth());
current_mc.main_mc.createEmptyMovieClip("mask_mc", current_mc.main_mc.getNextHighestDepth());
current_mc.reflection_mc.createEmptyMovieClip("mask_mc", current_mc.main_mc.getNextHighestDepth());
var w = (home_mc.thumb_mc.main_mc._width - 4);
var h = (home_mc.thumb_mc.main_mc._height - 4);
with (current_mc.main_mc.mask_mc) {
beginFill(255, 30);
lineStyle(0, 16711935, 50);
moveTo((-w) / 2, (-h) - 2);
lineTo(w / 2, (-h) - 2);
lineTo(w / 2, -2);
lineTo((-w) / 2, -2);
lineTo((-w) / 2, (-h) - 4);
endFill();
}
with (current_mc.reflection_mc.mask_mc) {
beginFill(255, 30);
lineStyle(0, 16711935, 50);
moveTo((-w) / 2, (-h) - 2);
lineTo(w / 2, (-h) - 2);
lineTo(w / 2, -2);
lineTo((-w) / 2, -2);
lineTo((-w) / 2, (-h) - 4);
endFill();
}
current_mc.main_mc.setMask(current_mc.main_mc.mask_mc);
current_mc.reflection_mc.setMask(current_mc.reflection_mc.mask_mc);
image_mcl.loadClip(filename, current_mc.main_mc.imgHolder_mc);
image_mcl.loadClip(filename, current_mc.reflection_mc.imgHolder_mc);
}
init();
stop();