# Kirupa Photo Gallery Tutorial

**URL:** <https://forum.kirupa.com/t/kirupa-photo-gallery-tutorial/99449>\
**Category:** Uncategorized\
**Created:** [January 18, 2004, 11:57pm UTC](https://forum.kirupa.com/t/kirupa-photo-gallery-tutorial/99449 "2004-01-18T23:57:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob\_Hed](https://avatars.discourse-cdn.com/v4/letter/r/8e7dd6/32.png) [@Rob\_Hed](https://forum.kirupa.com/u/Rob_Hed)\
**Post date:** [January 18, 2004, 11:57pm UTC](https://forum.kirupa.com/t/kirupa-photo-gallery-tutorial/99449/1 "2004-01-18T23:57:23Z")

</div>

I used this tutorial ([http://www.kirupa.com/developer/mx/photogallery.htm](http://www.kirupa.com/developer/mx/photogallery.htm))and everything worked great but i also wanted to other images to load in a different loadbox at the same time. (Using the same button) Not being in expert in action script, i duplicated the code, changed all the variable names accordingly but i had a problem. The 2 scripts don’t seem to work together. One loads the images properly and the other doen’t. If i take 1 off, the other works and vice-versa. I am sure i changed all the variable names but they still conflict somehow.

Any ideas.

Code:

this.pathToPics = “images/”;

this.pArray = [“journeys0.jpg”, “journeys1.jpg”, “journeys2.jpg”];  
this.fadeSpeed = 10;  
this.pIndex = 0;

loadMovie(this.pathToPics+this.pArray[0], \_root.loadbox);  
MovieClip.prototype.changePhoto = function(d) {  
// make sure pIndex falls within pArray.length  
this.pIndex = (this.pIndex+d)%this.pArray.length;  
if (this.pIndex\<0) {  
this.pIndex += this.pArray.length;  
}  
this.onEnterFrame = fadeOut;  
};  
MovieClip.prototype.fadeOut = function() {  
if (this.loadbox.\_alpha\>this.fadeSpeed) {  
this.loadbox.\_alpha -= this.fadeSpeed;  
} else {  
this.loadPhoto();  
}  
};  
MovieClip.prototype.loadPhoto = function() {  
// specify the movieclip to load images into  
var p = \_root.loadbox;  
//------------------------------------------  
p.\_alpha = 0;  
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);  
this.onEnterFrame = loadMeter;  
};  
MovieClip.prototype.loadMeter = function() {  
var i, l, t;  
l = this.loadbox.getBytesLoaded();  
t = this.loadbox.getBytesTotal();  
if (t\>0 && t == l) {  
this.onEnterFrame = fadeIn;  
} else {  
trace(l/t);  
}  
};  
MovieClip.prototype.fadeIn = function() {  
if (this.loadbox.\_alpha\<100-this.fadeSpeed) {  
this.loadbox.\_alpha += this.fadeSpeed;  
} else {  
this.loadbox.\_alpha = 100;  
this.onEnterFrame = null;  
}  
};

//------------------The other loadingbox-------------------

this.pathToPics = “images/”;  
// fill this array with your pics  
this.nArray = [“1of3.swf”, “2of3.swf”, “3of3.swf”];  
this.fadeSpeed2 = 10;  
this.nIndex = 0;  
// MovieClip methods ----------------------------------  
// d=direction; should 1 or -1 but can be any number  
//loads an image automatically when you run animation  
loadMovie(this.pathToPics+this.nArray[0], \_root.numbox);  
MovieClip.prototype.changeNum = function(d2) {  
// make sure pIndex falls within pArray.length  
this.nIndex = (this.nIndex+d2)%this.nArray.length;  
if (this.nIndex\<0) {  
this.nIndex += this.nArray.length;  
}  
this.onEnterFrame = fadeOut2;  
};  
MovieClip.prototype.fadeOut2 = function() {  
if (this.numbox.\_alpha\>this.fadeSpeed2) {  
this.numbox.\_alpha -= this.fadeSpeed2;  
} else {  
this.loadNum();  
}  
};  
MovieClip.prototype.loadNum = function() {  
// specify the movieclip to load images into  
var num = \_root.numbox;  
//------------------------------------------  
num.\_alpha = 0;  
num.loadMovie(this.pathToPics+this.nArray[this.nIndex]);  
this.onEnterFrame = loadMeter2;  
};  
MovieClip.prototype.loadMeter2 = function() {  
var i2, l2, t2;  
l2 = this.numbox.getBytesLoaded();  
t2 = this.numbox.getBytesTotal();  
if (t2\>0 && t2 == l2) {  
this.onEnterFrame = fadeIn2;  
} else {  
trace(l2/t2);  
}  
};  
MovieClip.prototype.fadeIn2 = function() {  
if (this.numbox.\_alpha\<100-this.fadeSpeed2) {  
this.numbox.\_alpha += this.fadeSpeed2;  
} else {  
this.numbox.\_alpha = 100;  
this.onEnterFrame = null;  
}  
};
