Instance of Symbol 11 MovieClip "Preloader" in Frame 2
onClipEvent (load) {
if (_parent.getBytesTotal() < 1000) {
fileSize = Math.floor(_parent.getBytesTotal()) + "bytes";
} else if (_parent.getBytesTotal() > 1000000) {
fileSize = math.floor(_parent.getBytesTotal() / 1000000) + "mb";
} else {
fileSize = math.floor(_parent.getBytesTotal() / 1000) + "k";
}
message = "";
}
onClipEvent (enterFrame) {
percent = Math.floor((_parent.getBytesLoaded() / _parent.getBytesTotal()) * 100);
output = ((percent + "% of ") + filesize) + " loaded";
Bar._xscale = percent;
if (percent == 100) {
this._visible = 0;
}
}
Frame 19
stop();
Symbol 21 MovieClip Frame 1
function makePage(targ, xQuadrant) {
with (targ) {
beginFill(pageColor, 100);
moveTo(0, -pageWi);
lineTo(0, -pageWiHi);
lineTo(xQuadrant * pageWi, -pageWiHi);
lineTo(xQuadrant * pageWi, -pageWi);
endFill();
}
}
function makeShade(targ, xQuadrant) {
with (targ) {
var colors = [0, 0, 0, 0, 0, 0, 0];
var alphas = [40, 25, 15, 5, 0, 1, 6];
var ratios = [0, 1, 17, 51, 89, 132, 255];
var matrix = {matrixType:"box", x:0, y:pageWi, w:xQuadrant * pageWi, h:pageHi, r:0};
beginGradientFill("linear", colors, alphas, ratios, matrix);
moveTo(0, -pageWi);
lineTo(0, -pageWiHi);
lineTo(xQuadrant * pageWi, -pageWiHi);
lineTo(xQuadrant * pageWi, -pageWi);
endFill();
}
}
function makeShadow(targ, xQuadrant) {
with (targ) {
var colors = [0, 0, 0, 0, 0, 0, 0];
var alphas = [40, 25, 15, 5, 0, 1, 6];
var ratios = [0, 1, 17, 51, 89, 132, 255];
var maxLength = Math.sqrt((pageWi * pageWi) + (pageWiHi * pageWiHi));
var matrix = {matrixType:"box", x:0, y:-maxLength, w:xQuadrant * pageWi, h:maxLength - pageWi, r:0};
beginGradientFill("linear", colors, alphas, ratios, matrix);
moveTo(0, -pageWi);
lineTo(0, -maxLength);
lineTo(xQuadrant * pageWi, -maxLength);
lineTo(xQuadrant * pageWi, -pageWi);
endFill();
}
}
function setStationary() {
createEmptyMovieClip("SLPage", 1);
if (flipPage != 1.5) {
makePage(SLPage, -1);
SLPage.attachMovie("print" + (flipPage - 1.5), "Print", 1);
with (SLPage.Print) {
_x = (-pageWi) / 2;
_y = -pivotY;
}
}
createEmptyMovieClip("SRPage", 2);
if (flipPage != (maxPages - 0.5)) {
makePage(SRPage, 1);
SRPage.attachMovie("print" + (flipPage + 1.5), "Print", 1);
with (SRPage.Print) {
_x = pageWi / 2;
_y = -pivotY;
}
}
var targ = ((dir > 0) ? (SLPage) : (SRPage));
targ.createEmptyMovieClip("Shade", 2);
makeShade(targ.Shade, -dir);
}
function setFlipping() {
var targ;
createEmptyMovieClip("FTPage", 3);
makePage(FTPage, dir);
with (FTPage) {
attachMovie("print" + (flipPage - (dir * 0.5)), "Print", 1);
with (Print) {
_x = (dir * pageWi) / 2;
_y = -pivotY;
}
}
FTPage.createEmptyMovieClip("Shade", 2);
makeShade(FTPage.Shade, dir);
createEmptyMovieClip("FBPage", 4);
makePage(FBPage, -dir);
FBPage.attachMovie("print" + (flipPage + (dir * 0.5)), "Print", 1);
with (FBPage.Print) {
_x = ((-dir) * pageWi) / 2;
_y = -pivotY;
}
FBPage._rotation = dir * 90;
}
function setShadows() {
var targ;
this.createEmptyMovieClip("FShadow", 5);
makeShadow(FShadow, -dir);
FShadow._rotation = dir * 45;
this.createEmptyMovieClip("SShadow", 6);
makeShadow(SShadow, dir);
SShadow._rotation = dir * 45;
}
function makeMasks() {
this.createEmptyMovieClip("FBPageMask", 7);
with (FBPageMask) {
beginFill(21760, 100);
lineTo(pageWiHi, -pageWiHi);
curveTo(0, -2 * pageWiHi, -pageWiHi, -pageWiHi);
endFill();
}
FBPageMask.duplicateMovieClip("FTPageMask", 8);
this.createEmptyMovieClip("FShadowMask", 9);
makePage(FShadowMask, -dir);
FShadowMask._rotation = dir * 90;
this.createEmptyMovieClip("SShadowMask", 10);
makePage(SShadowMask, dir);
FBPage.setMask(FBPageMask);
FTPage.setMask(FTPageMask);
FShadow.setMask(FShadowMask);
SShadow.setMask(SShadowMask);
}
function limitBook() {
if (flipPage == 1.5) {
SLPage._visible = 0;
LButton._visible = 0;
SShadow._visible = 0;
if (dir == 1) {
FTPage.Shade._alpha = 67;
SShadow._visible = 1;
} else {
FShadow._alpha = 67;
}
} else if (flipPage == (maxPages - 0.5)) {
SRPage._visible = 0;
RButton._visible = 0;
SShadow._visible = 0;
if (dir == -1) {
FTPage.Shade._alpha = 67;
SShadow._visible = 1;
} else {
FShadow._alpha = 67;
}
}
}
function pageInit(cp, d) {
flipPage = cp;
dir = d;
setStationary();
setFlipping();
setShadows();
makeMasks();
limitBook();
}
function flip(curVal) {
var _local1 = (dir * 45) * curVal;
FBPageMask._rotation = (FTPageMask._rotation = -_local1);
FBPage._rotation = (FShadowMask._rotation = (dir * 90) - (_local1 * 2));
FShadow._rotation = (SShadow._rotation = (dir * 45) - _local1);
}
function getPageRatio() {
if (dragging) {
pageRatio = ((-dir) * ((_xmouse - startX) - (dir * 20))) / (2 * pageWi);
} else {
((pageRatio > 0.666666666666667) ? ((pageRatio = pageRatio + autoStep)) : ((pageRatio = pageRatio - autoStep)));
}
if (pageRatio <= 0) {
pageRatio = 0;
if (!dragging) {
flipDone();
}
} else if (pageRatio >= 1) {
pageRatio = 1;
if (!dragging) {
flipDone();
}
}
return(pageRatio);
}
function startFlip(dir) {
var _local1 = dir;
pageInit(curPage + _local1, _local1);
startX = _local1 * pageWi;
dragging = true;
RButton._alpha = 0;
Lbutton._alpha = 0;
this.onEnterFrame = function () {
flip(getPageRatio());
};
}
function flipRelease() {
dragging = false;
if (pageRatio > 0.666666666666667) {
curPage = curPage + (2 * dir);
}
}
function flipDone() {
this.onEnterFrame = null;
RButton._alpha = 100;
LButton._alpha = 100;
if (curPage != 0.5) {
LButton._visible = 1;
}
if (curPage != (maxPages + 0.5)) {
RButton._visible = 1;
}
if (pageRatio == 0) {
FShadow.removeMovieClip();
FShadowMask.removeMovieClip();
SShadow.removeMovieClip();
SShadowMask.removeMovieClip();
FBPage.removeMovieClip();
FBPageMask.removeMovieClip();
if (dir == 1) {
SRPage.removeMovieClip();
} else {
SLPage.removeMovieClip();
}
} else {
FTPage.removeMovieClip();
if (dir == -1) {
SRPage.removeMovieClip();
} else {
SLPage.removeMovieClip();
}
}
FTPageMask.removeMovieClip();
}
stop();
_level0.pagesAbs = this;
var pageWi = 630;
var pageHi = 842;
var pageWiHi = (pageWi + pageHi);
var pivotY = ((pageHi / 2) + pageWi);
var pageColor = 16777189;
var dir = 1;
var flipPage = 1.5;
var curPage = 0.5;
var maxPages = 16;
var autoStep = 0.05;
var dragging = false;
this.attachMovie("cornerButton", "RButton", 11);
with (RButton) {
_x = pageWi;
_y = -pageWi;
}
this.attachMovie("cornerButton", "LButton", 12);
with (LButton) {
_x = -pageWi;
_y = -pageWi;
_xscale = -100;
}
pageInit(flipPage, dir);
_y = (_y + pivotY);
LButton.onPress = function () {
startFlip(-1);
};
LButton.onReleaseOutside = function () {
flipRelease();
};
LButton.onRelease = function () {
flipRelease();
};
RButton.onPress = function () {
startFlip(1);
};
RButton.onReleaseOutside = function () {
flipRelease();
};
RButton.onRelease = function () {
flipRelease();
};