Frame 1
stop();
Instance of Symbol 15 MovieClip [FPreloading] in Frame 1
//component parameters
onClipEvent (construct) {
barColor = 8166622 /* 0x7C9CDE */;
borderColor = 0;
txtColor = 0;
txtFont = "Century Gothic";
loadingTxt = "Loading";
barDisp = true;
timeDisp = true;
percentDisp = true;
bytesDisp = true;
}
Frame 173
gotoAndPlay (174);
Frame 357
gotoAndPlay (358);
Frame 436
stop();
Symbol 15 MovieClip [FPreloading] Frame 1
#initclip 1
function PreloadingClass() {
this.init();
}
function setDisplayTime(txt) {
if (txt < 10) {
txt = "0" + txt;
}
return(txt);
}
PreloadingClass.prototype = new MovieClip();
Object.registerClass("FPreloading", PreloadingClass);
PreloadingClass.prototype.init = function () {
this.listenerList = [];
this.barCObj = new Color(this.barRect);
this.borderCObj = new Color(this.borderRect);
this.startT = getTimer() / 1000;
this.percentValue = 0;
this.w = this._width;
this._xscale = (this._yscale = 100);
txtF = new Array("loadTxt", "percentTxt", "bytesTxt", "elapsedTxt", "leftTxt");
txtFormat = new TextFormat();
with (txtFormat) {
font = this.txtFont;
color = this.txtColor;
}
this.setBarColor(this.barColor);
this.setBorderColor(this.borderColor);
this.borderRect._width = this.w;
this.barRect._width = this.borderRect._width - 4;
this.barRect.full = this.barRect._width;
i = 0;
while (i < txtF.length) {
this[txtF[i]].setNewTextFormat(txtFormat);
if (i == 3) {
align = "left";
} else if (i == 4) {
align = "right";
} else {
align = "center";
}
this.setPosition(this[txtF[i]], align);
i++;
}
this.setCaptionTxt(this.loadingTxt);
this.setBarDisp(this.barDisp);
this.setTimeDisp(this.timeDisp);
this.setPercentDisp(this.percentDisp);
this.setBytesDisp(this.bytesDisp);
this.updateDisp();
this._parent.stop();
};
PreloadingClass.prototype.setPosition = function (targetObj, align) {
switch (align) {
case "center" :
targetObj._x = (this.w / 2) - (targetObj._width / 2);
break;
case "left" :
targetObj._x = 0;
break;
case "right" :
targetObj._x = this.w - targetObj._width;
}
};
PreloadingClass.prototype.updateDisp = function () {
this.elapsedTxt._y = (this.leftTxt._y = 15 + (this.barDisp * 13));
this.percentTxt._y = (15 + (this.barDisp * 13)) + (this.timeDisp * 10);
this.bytesTxt._y = ((15 + (this.barDisp * 13)) + (this.timeDisp * 10)) + (this.percentDisp * 10);
};
PreloadingClass.prototype.setCaptionTxt = function (txt) {
this.loadTxt.text = (this.loadingTxt = txt);
};
PreloadingClass.prototype.getCaptionTxt = function () {
return(this.loadingTxt);
};
PreloadingClass.prototype.setBarDisp = function (bool) {
this.barDisp = (this.barRect._visible = (this.borderRect._visible = bool));
this.updateDisp();
};
PreloadingClass.prototype.getBarDisp = function () {
return(this.barDisp);
};
PreloadingClass.prototype.setBarColor = function (c) {
this.barColor = c;
this.barCObj.setRGB(c);
};
PreloadingClass.prototype.getBarColor = function () {
return(this.barColor);
};
PreloadingClass.prototype.setBorderColor = function (c) {
this.borderColor = c;
this.borderCObj.setRGB(c);
};
PreloadingClass.prototype.getBorderColor = function () {
return(this.borderColor);
};
PreloadingClass.prototype.setTimeDisp = function (bool) {
this.timeDisp = (this.elapsedTxt._visible = (this.leftTxt._visible = bool));
this.updateDisp();
};
PreloadingClass.prototype.getTimeDisp = function () {
return(this.timeDisp);
};
PreloadingClass.prototype.setPercentDisp = function (bool) {
this.percentDisp = (this.percentTxt._visible = bool);
this.updateDisp();
};
PreloadingClass.prototype.getPercentDisp = function () {
return(this.percentDisp);
};
PreloadingClass.prototype.setBytesDisp = function (bool) {
this.bytesDisp = (this.bytesTxt._visible = bool);
this.updateDisp();
};
PreloadingClass.prototype.getBytesDisp = function () {
return(this.bytesDisp);
};
PreloadingClass.prototype.getPercent = function () {
return(this.percentValue);
};
PreloadingClass.prototype.getKBLoaded = function () {
return(this.loadKBText);
};
PreloadingClass.prototype.getKBTotal = function () {
return(this.totalKBText);
};
PreloadingClass.prototype.addListener = function (ref) {
this.listenerList[ref] = ref;
};
PreloadingClass.prototype.removeListener = function (ref) {
delete this.listenerList[ref];
};
PreloadingClass.prototype.sendChangedEvent = function (value) {
for (i in this.listenerList) {
this.listenerList[i].onChanged(value);
}
};
PreloadingClass.prototype.onEnterFrame = function () {
totalB = this._parent.getBytesTotal();
loadB = this._parent.getBytesLoaded();
this.percentValue = (((totalB == 0) || (totalB == undefined)) ? 0 : (Math.round((100 * loadB) / totalB)));
this.loadKBText = Math.round(loadB / 1024);
this.totalKBText = Math.round(totalB / 1024);
nowT = Math.round((getTimer() / 1000) - this.startT);
if (nowT != lastT) {
diffB = loadB - lastB;
if (diffB > 0) {
leftT = Math.floor((totalB - loadB) / diffB);
minLT = setDisplayTime(Math.round(leftT / 60));
secLT = setDisplayTime(leftT % 60);
} else {
leftT = "Idle";
}
lastB = loadB;
lastT = nowT;
}
minET = setDisplayTime(Math.round(nowT / 60));
secET = setDisplayTime(nowT % 60);
this.percentTxt.text = this.percentValue + " %";
this.bytesTxt.text = ((this.loadKBText + " / ") + this.totalKBText) + " kb";
this.elapsedTxt.text = ((("Elapsed: " + minET) + ".") + secET) + " min";
if (leftT != "Idle") {
this.leftTxt.text = ((("Left: " + minLT) + ".") + secLT) + " min";
} else {
this.leftTxt.text = "Left: " + leftT;
}
this.barRect._width = (this.percentValue * this.barRect.full) / 100;
if (oldPercent != this.percentValue) {
this.sendChangedEvent(this.percentValue);
oldPercent = this.percentValue;
}
if ((this.percentValue >= 100) && (totalB > 4)) {
this._parent.play();
delete PreloadingClass.prototype.onEnterFrame;
}
};
with (PreloadingClass.prototype) {
addProperty("caption", getCaptionTxt, setCaptionTxt);
addProperty("showBar", getBarDisp, setBarDisp);
addProperty("showTime", getTimeDisp, setTimeDisp);
addProperty("showPercent", getPercentDisp, setPercentDisp);
addProperty("showBytes", getBytesDisp, setBytesDisp);
addProperty("percent", getPercent, null);
addProperty("loadKB", getKBLoaded, null);
addProperty("totalKB", getKNTotal, null);
}
#endinitclip
Symbol 85 Button
on (release) {
gotoAndPlay (2);
}