MovieClip.prototype.photoGallery = function(path, trgt, seed, maxSeed, format, fIn, thumbX, thumbY, thumbOutline, maskHeight, arrowSize, scrollSpeed, w, h, lbH, dist, jpgLoadTxt, txtXPos, txtYPos, txtStyle, fontName, txtSize, txtClr, html, bold, Italic, boxWidth, boxHeight, imageX, imageY, boxCentred, imageCentred, trgtImage) {
_global.maxSeed = maxSeed;
_global.seed = seed;
_global.path = path;
_global.thumbX = thumbX;
_global.thumbY = thumbY;
_global.format = format;
_global.trgtImage = trgtImage;
_global.imageCentred = imageCentred;
_global.dist = dist;
_global.boxWidth = boxWidth;
_global.imageX = imageX;
_global.imageY = imageY;
_global.fIn = fIn;
_global.scrollSpeed = scrollSpeed;
seedOrig = seed;
path._x = thumbX;
path._y = thumbY;
imageBox(boxHeight, imageY, boxCentred);
thumbBox(thumbOutline, maskHeight);
howManyNails(txtStyle, jpgLoadTxt, txtXPos, txtYPos, fontName, txtSize, txtClr, bdr, bdrClr, html, bold, italic);
path.createEmptyMovieClip("thumbs", 1);
path.thumbs._x = -dist;
scrollMask(maskHeight, thumbX, thumbY);
loadThumbnails(trgt, format, dist, prev_x, prev_w);
drawBar(w, h, lbH, dist);
onEnterFrame = function () {
imageProgressBarRun();
removeImageBar();
imageSquash();
imageCentre();
loadIn(path.imageStuff.image);
needArrows(arrowSize, dist, h);
path.thumbs["thumb"+seed].onPress = Press;
path.thumbs["thumb"+seed].onRelease = Release;
path.thumbs["thumb"+seed].onEnterFrame = EnterFrame;
if (allFadedIn != true) {
loadingBarRun(txtStyle);
if (seed<maxSeed) {
prev_x = path.thumbs["thumb"+seed]._x;
prev_w = path.thumbs["thumb"+seed]._width;
if (path.thumbs["thumb"+seed]._width>0) {
removeBars();
if (path.thumbs["thumb"+seed]._alpha>=100) {
_global.seed = seed += 1;
drawBar(w, h, lbH, dist, prev_x, prev_w);
loadThumbnails(trgt, format, dist, prev_x, prev_w);
} else {
loadIn(path.thumbs["thumb"+seed]);
}
}
} else if (seed == maxSeed && path.thumbs["thumb"+seed]._width>0) {
loadOut(path.totalLB);
loadOut(path.totalLBB);
path[jpgLoadTxt].removeTextField();
removeBars();
loadIn(path.thumbs["thumb"+maxSeed]);
if (path.thumbs["thumb"+seed]._alpha>100) {
allFadedIn = true;
}
}
}
};
};
//
// Fading functions
//
function loadIn(mc) {
if (mc.getBytesLoaded() == mc.getBytesTotal() && mc._alpha<100 && mc._width>0) {
if (mc._alpha<100) {
mc._alpha += fIn;
}
}
}
function loadOut(mc) {
mc._alpha -= fIn;
}
//
// Thumbnail loading, masking and scrolling functions
//
function thumbAlign() {
if (alignThumbs == true) {
_global.thumbX = thumbX=boxWidth-2*thumbX;
}
}
function loadThumbnails(trgt, format, dist, prev_x, prev_w) {
path.thumbs.createEmptyMovieClip("thumb"+seed, seed).loadMovie(trgt+seed+format+"?nocache="+getDate(), path.thumbs["thumb"+seed]);
path.thumbs["thumb"+seed]._alpha = 0;
path.thumbs["thumb"+seed]._x = prev_x+prev_w+dist;
}
function scrollMask(maskHeight, thumbX, thumbY) {
path.createEmptyMovieClip("scrollMask", maxSeed+5);
path.thumbs.setMask(path.scrollMask);
path.scrollMask.lineStyle(.25, 0x999999, 100);
path.scrollMask.beginFill(0xFF0000, 40);
path.scrollMask.moveTo(0, 0);
path.scrollMask.lineTo(Stage.width-2*thumbX, 0);
path.scrollMask.lineTo(Stage.width-2*thumbX, maskHeight);
path.scrollMask.lineTo(0, maskHeight);
path.scrollMask.lineTo(0, 0);
path.scrollMask.endFill();
}
function thumbBox(thumbOutline, maskHeight) {
if (thumbOutline == true) {
path.createEmptyMovieClip("thumbBox", 2);
path.thumbBox.lineStyle(.25, 0x999999, 100);
path.thumbBox.moveTo(-2, -2);
path.thumbBox.lineTo(Stage.width-2*thumbX+2, -2);
path.thumbBox.lineTo(Stage.width-2*thumbX+2, maskHeight+2);
path.thumbBox.lineTo(-2, maskHeight+2);
path.thumbBox.lineTo(-2, -2);
}
}
function needArrows(arrowSize, dist, h) {
if (path.scrollMask._width<path.thumbs._width) {
if (runMeOnce != true) {
drawArrows(arrowSize);
placeArrows(arrowSize, dist, h);
runMeOnce == true;
path.arrows.arrowLeft._alpha = path.arrows.arrowRight._alpha=100;
}
path.arrows.arrowLeft.onPress = pAL;
path.arrows.arrowRight.onPress = pAR;
path.arrows.onMouseUp = rA;
path.thumbs.onEnterFrame = scrollDirection;
}
}
function drawArrows(arrowSize) {
path.createEmptyMovieClip("arrows", 3);
path.arrows.createEmptyMovieClip("arrowLeft", 1);
path.arrows.arrowLeft.lineStyle(.25, 0x999999, 100);
path.arrows.arrowLeft.beginFill(0x666666, 40);
path.arrows.arrowLeft.moveTo(0, 0);
path.arrows.arrowLeft.lineTo(0, 3*arrowSize/5);
path.arrows.arrowLeft.lineTo(-arrowSize/2, 3*arrowSize/5);
path.arrows.arrowLeft.lineTo(-arrowSize/2, 4*arrowSize/5);
path.arrows.arrowLeft.lineTo(-arrowSize, 3*arrowSize/10);
path.arrows.arrowLeft.lineTo(-arrowSize/2, -arrowSize/5);
path.arrows.arrowLeft.lineTo(-arrowSize/2, 0);
path.arrows.arrowLeft.lineTo(0, 0);
path.arrows.arrowLeft.endFill();
path.arrows.createEmptyMovieClip("arrowRight", 2);
path.arrows.arrowRight.lineStyle(.25, 0x999999, 100);
path.arrows.arrowRight.beginFill(0x666666, 40);
path.arrows.arrowRight.moveTo(0, 0);
path.arrows.arrowRight.lineTo(arrowSize/2, 0);
path.arrows.arrowRight.lineTo(arrowSize/2, -arrowSize/5);
path.arrows.arrowRight.lineTo(arrowSize, 3*arrowSize/10);
path.arrows.arrowRight.lineTo(arrowSize/2, 4*arrowSize/5);
path.arrows.arrowRight.lineTo(arrowSize/2, 3*arrowSize/5);
path.arrows.arrowRight.lineTo(0, 3*arrowSize/5);
path.arrows.arrowRight.lineTo(0, 0);
path.arrows.arrowRight.endFill();
}
function placeArrows(arrowSize, dist, h) {
if (thumbX+5>arrowSize) {
path.arrows.arrowLeft._x = -1.2*dist-5;
path.arrows.arrowRight._x = Stage.width-2*thumbX+dist+5;
path.arrows.arrowRight._y = path.arrows.arrowLeft._y=arrowSize/5;
} else {
path.arrows.arrowLeft._x = arrowSize+5;
path.arrows.arrowRight._x = 2*arrowSize;
path.arrows.arrowRight._y = path.arrows.arrowLeft._y=-arrowSize-2*h;
}
}
function pAL() {
path.thumbs.thumbsMove = -1;
path.thumbs.thumbsSlowDown=0;
}
function pAR() {
path.thumbs.thumbsMove = 1;
path.thumbs.thumbsSlowDown=0;
}
function rA() {
path.thumbs.thumbsSlowDown=1;
}
function scrollDirection() {
if (path.thumbs.thumbsMove == 1) {
if(runOncei!=true){
path.thumbs.scrollSpeed= scrollSpeed;
runOncei=true;
}
if(path.thumbs.thumbsSlowDown==0){
runOncei=false;
}
path.thumbs._x -= path.thumbs.scrollSpeed;
if (path.thumbs._x<-(path.thumbs._width)+(Stage.width-(2*thumbX))){
path.thumbs._x = -(path.thumbs._width)+(Stage.width-(2*thumbX));
}
} else if (path.thumbs.thumbsMove == -1) {
if(runOncei!=true){
path.thumbs.scrollSpeed= scrollSpeed;
runOncei=true;
}
if(path.thumbs.thumbsSlowDown==0){
runOncei=false;
}
path.thumbs._x += path.thumbs.scrollSpeed
if (path.thumbs._x>-dist) {
path.thumbs._x = -dist;
}
}
if (path.thumbs.thumbsSlowDown==1 && path.thumbs.thumbsMove == 1){
path.thumbs.scrollSpeed=0.85*path.thumbs.scrollSpeed;
if(path.thumbs.scrollSpeed<=0.05 ){
path.thumbs.thumbsMove=0;
path.thumbs.thumbsSlowDown=0;
runOncei=false;
}
} else if (path.thumbs.thumbsSlowDown==1 && path.thumbs.thumbsMove == -1){
path.thumbs.scrollSpeed=0.85*path.thumbs.scrollSpeed;
if(path.thumbs.scrollSpeed<=-0.05 ){
path.thumbs.thumbsMove=0;
path.thumbs.thumbsSlowDown=0;
runOncei=false;
}
}
}
function drawBar(w, h, lbH, dist, prev_x, prev_w) {
path.thumbs.createEmptyMovieClip("loadingBarBox"+seed, 2*maxSeed+seed);
path.thumbs["loadingBarBox"+seed]._x = prev_x+prev_w+dist;
path.thumbs["loadingBarBox"+seed].lineStyle(.25, 0x999999, 100);
path.thumbs["loadingBarBox"+seed].moveTo(0, h);
path.thumbs["loadingBarBox"+seed].lineTo(w, h);
path.thumbs["loadingBarBox"+seed].lineTo(w, h-lbH);
path.thumbs["loadingBarBox"+seed].lineTo(0, h-lbH);
path.thumbs["loadingBarBox"+seed].lineTo(0, h);
path.thumbs.createEmptyMovieClip("loadingBar"+seed, maxSeed+seed);
path.thumbs["loadingBar"+seed]._xscale = 0;
path.thumbs["loadingBar"+seed]._x = prev_x+prev_w+dist;
path.thumbs["loadingBar"+seed].lineStyle(.25, 0x999999, 0);
path.thumbs["loadingBar"+seed].beginFill(0x999999, 100);
path.thumbs["loadingBar"+seed].moveTo(0, h);
path.thumbs["loadingBar"+seed].lineTo(w, h);
path.thumbs["loadingBar"+seed].lineTo(w, h-lbH);
path.thumbs["loadingBar"+seed].lineTo(0, h-lbH);
path.thumbs["loadingBar"+seed].lineTo(0, h);
path.thumbs["loadingBar"+seed].endFill();
}
function loadingBarRun(txtStyle) {
path.thumbs.byteL = path.thumbs["thumb"+seed].getBytesLoaded();
path.thumbs["loadingBar"+seed]._xscale = (path.thumbs.byteL/path.thumbs["thumb"+seed].getBytesTotal())*100;
loadingTxt(txtStyle);
path.totalLB._xscale = (seed/maxSeed)*100;
}
function removeBars() {
path.thumbs["loadingBar"+seed].removeMovieClip();
path.thumbs["loadingBarBox"+seed].removeMovieClip();
if (path.totalLB._alpha<0) {
path.totalLB.removeMovieClip();
path.totalLBB.removeMovieClip();
}
}