Combined Code
frame 1 {
stop();
_global.printVersion = 'print';
trace('print version = ' + _global.printVersion);
}
movieClip 6 {
}
movieClip 10 {
}
button 11 {
on (release) {
getURL('http://www.newgrounds.com', '_blank');
}
}
movieClip 12 {
}
button 20 {
on (release) {
_root.play();
}
}
movieClip 21 {
frame 1 {
function timerHandler() {
if (!loadingComplete) {
var v2 = _root.getBytesLoaded() / _root.getBytesTotal();
bar._xscale = 100 * v2;
if (v2 == 1) {
loadingComplete = true;
if (AUTO_PLAY) {
startMovie();
return undefined;
}
gotoAndStop('loaded');
return undefined;
}
}
}
function startMovie() {
_root.play();
}
_root.stop();
stop();
var AUTO_PLAY = false;
var loadingComplete = false;
timerHandler();
}
instance of movieClip 12 {
onClipEvent (enterFrame) {
_parent.timerHandler();
}
}
frame 2 {
stop();
}
}
// unknown tag 88 length 179
// unknown tag 88 length 178
movieClip 32 print1 {
}
movieClip 35 print2 {
}
movieClip 41 print3 {
}
movieClip 44 print4 {
}
// unknown tag 88 length 211
movieClip 49 {
}
movieClip 50 print5 {
}
movieClip 54 print6 {
}
movieClip 58 print7 {
}
movieClip 62 print8 {
}
movieClip 66 print9 {
}
movieClip 70 print10 {
}
movieClip 74 print11 {
}
movieClip 77 print12 {
}
movieClip 81 print13 {
}
movieClip 84 print14 {
}
movieClip 88 print15 {
}
movieClip 92 print16 {
}
// unknown tag 88 length 68
movieClip 125 {
frame 1 {
stop();
}
}
movieClip 129 print17 {
}
movieClip 133 print18 {
}
movieClip 137 Print19 {
}
movieClip 141 Print20 {
}
// unknown tag 88 length 206
// unknown tag 88 length 211
movieClip 154 Print21 {
}
movieClip 158 Print22 {
}
movieClip 161 Print23 {
}
movieClip 164 Print24 {
}
movieClip 168 Print25 {
}
movieClip 172 Print26 {
}
movieClip 176 Print27 {
}
movieClip 181 Print28 {
}
movieClip 185 Print29 {
}
movieClip 188 Print30 {
}
movieClip 192 Print31 {
}
movieClip 196 Print32 {
}
movieClip 200 Print33 {
}
movieClip 204 Print34 {
}
movieClip 208 Print35 {
}
movieClip 211 Print36 {
}
movieClip 215 Print37 {
}
movieClip 226 Print38 {
}
movieClip 237 Print39 {
}
movieClip 241 Print40 {
}
movieClip 244 Print41 {
}
movieClip 248 Print42 {
}
movieClip 252 Print43 {
}
movieClip 256 Print44 {
}
movieClip 260 Print45 {
}
movieClip 264 Print46 {
}
movieClip 268 Print47 {
}
movieClip 272 Print48 {
}
movieClip 276 Print49 {
}
movieClip 280 Print50 {
}
movieClip 284 Print51 {
}
movieClip 288 Print52 {
}
movieClip 293 Print53 {
}
movieClip 297 Print54 {
}
movieClip 301 Print55 {
}
movieClip 305 Print56 {
}
movieClip 308 Print57 {
}
movieClip 311 Print58 {
}
movieClip 315 Print59 {
}
movieClip 319 Print60 {
}
movieClip 324 Print61 {
}
movieClip 327 Print62 {
}
// unknown tag 88 length 218
movieClip 332 Print63 {
}
// unknown tag 88 length 79
movieClip 337 Print64 {
}
movieClip 338 Printz5 {
}
movieClip 339 Printz4 {
}
// unknown tag 88 length 202
frame 3 {
stop();
var newVer = _global.printVersion;
watch(_global.printVersion, versionWatcher);
var versionWatcher = function (newVer, oldVal, newVal) {
newVal = 'print';
if (newVal) {
trace('Print is on');
return newVal;
}
trace('Print is off');
return newVal;
};
}
movieClip 349 {
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('' + pageVersion + (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 v2;
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 v1 = dir * 45 * curVal;
FTPageMask._rotation = -v1;
FBPageMask._rotation = FTPageMask._rotation;
FShadowMask._rotation = dir * 90 - v1 * 2;
FBPage._rotation = FShadowMask._rotation;
SShadow._rotation = dir * 45 - v1;
FShadow._rotation = SShadow._rotation;
}
function getPageRatio() {
if (dragging) {
pageRatio = -dir * (_xmouse - startX - dir * 20) / 2 * pageWi;
} else {
if (pageRatio <= 0.6666666666666666) {
pageRatio -= autoStep;
} else {
pageRatio += autoStep;
}
pageRatio;
}
if (pageRatio <= 0) {
pageRatio = 0;
if (!dragging) {
flipDone();
}
return pageRatio;
}
if (pageRatio >= 1) {
pageRatio = 1;
if (!dragging) {
flipDone();
}
}
return pageRatio;
}
function startFlip(dir) {
pageInit(curPage + dir, dir);
startX = dir * pageWi;
dragging = true;
RButton._alpha = 0;
Lbutton._alpha = 0;
this.onEnterFrame = function () {
flip(getPageRatio());
};
}
function flipRelease() {
dragging = false;
if (pageRatio > 0.6666666666666666) {
curPage += 2 * dir;
pageChanged = true;
}
}
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();
}
function setNar() {
if (pageRatio > 0.6666666666666666) {
if (curPage >= 2.5) {
narPage = (curPage - 0.5) / 2 - 1;
} else {
narPage = 0;
}
narPage;
if (dir == 1) {
prevNarPage = narPage - 1;
} else {
if (dir == -1) {
prevNarPage = narPage + 1;
}
}
fade(prevNarPage);
_root['holder' + narPage].setVolume(100);
_root['holder' + narPage].start();
}
}
function setAmbiance() {
if (pageRatio > 0.6666666666666666) {
if (curPage >= 2.5) {
ambTracker = (curPage - 0.5) / 2;
} else {
ambTracker = 0;
}
ambTracker;
var v1 = 0;
while (v1 < numAmb) {
if (section[v1] == ambTracker) {
ambiance[v1].setVolume(100);
ambiance[v1].start();
return undefined;
} else {
ambiance[v1].stop();
}
++v1;
}
}
}
function fade(numNar) {
narratives[numNar].stop();
}
function setSound() {
setAmbiance();
setNar();
}
stop();
_level0.pagesAbs = this;
var pageWi = 471;
var pageHi = 666;
var pageWiHi = pageWi + pageHi;
var pivotY = pageHi / 2 + pageWi;
var pageColor = 16777189;
var pageVersion = _global.printVersion;
trace('pageVersion update = ' + pageVersion);
var dir = 1;
var flipPage = 1.5;
var curPage = 0.5;
var maxPages = 64;
var autoStep = 0.05;
var dragging = false;
var narPage = 0;
var narFader;
var prevNarPage = 0;
var numNarratives = 30;
var narratives = new Array(numNarratives);
var i = 1;
while (i <= numNarratives) {
_root['holder' + i] = new Sound();
_root['holder' + i].attachSound('nar' + i);
++i;
}
var numAmb = 6;
var ambTracker = 0;
var section = new Array(1, 10, 20, 30, 40, 50);
var ambiance = new Array(numAmb);
var q = 0;
while (q <= numAmb) {
var ambHolder = new Sound();
ambHolder.attachSound('amb' + i);
ambiance[q] = ambHolder;
++q;
}
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 + 150);
LButton.onPress = function () {
startFlip(-1);
};
LButton.onReleaseOutside = function () {
flipRelease();
setSound();
};
LButton.onRelease = function () {
flipRelease();
setSound();
};
RButton.onPress = function () {
startFlip(1);
};
RButton.onReleaseOutside = function () {
flipRelease();
setSound();
};
RButton.onRelease = function () {
flipRelease();
setSound();
};
}
}