# Photo gallery tutorial help!

**URL:** <https://forum.kirupa.com/t/photo-gallery-tutorial-help/244222>\
**Category:** Uncategorized\
**Created:** [November 15, 2007, 12:34pm UTC](https://forum.kirupa.com/t/photo-gallery-tutorial-help/244222 "2007-11-15T12:34:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clinton](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@Clinton](https://forum.kirupa.com/u/Clinton)\
**Post date:** [November 15, 2007, 12:34pm UTC](https://forum.kirupa.com/t/photo-gallery-tutorial-help/244222/1 "2007-11-15T12:34:43Z")

</div>

Hi Im relatively new to actionscripting and im trying to modify the photo gallery tutorial which is on this site. I have provided the code below. Basically i have modified the original script with the help of other tutorials on this site. So right now i have it automatically changing between images with an interval of 3 seconds and also displaying the array of images in a random sequence. [COLOR=Black]What i really, really, really, really want it to do from here is to load this movie onto multiple movieclip targets situated on the stage, so that there are like 6 instances of the movie on stage.

If anyone could help me i would greatly appreciate it!!!(-:  
[COLOR=SeaGreen]  
[/COLOR]\*\*[COLOR=SeaGreen]my script:[/COLOR]  
\*\*  
[COLOR=SeaGreen]// variables ------------------------------------------  
// put the path to your pics here, include the slashes (ie. “pics/”)  
// leave it blank if they’re in the same directory  
this.pathToPics = “image\_files/”;  
// fill this array with your pics  
this.pArray = [“2.jpg”, “3.jpg”, “4.jpg”,“5.jpg”,“6.jpg”,“7.jpg”,“8.jpg”];  
this.fadeSpeed = 20;  
this.pIndex = 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.pArray[0], \_root.myMC1);  
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.myMC1.\_alpha\>this.fadeSpeed) {  
this.myMC1.\_alpha -= this.fadeSpeed;  
} else {  
this.loadPhoto();  
}  
};  
MovieClip.prototype.loadPhoto = function() {  
// specify the movieclip to load images into  
var p = \_root.myMC1;  
//------------------------------------------  
p.\_alpha = 0;  
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);  
this.onEnterFrame = loadMeter;  
};  
MovieClip.prototype.loadMeter = function() {  
var i, l, t;  
l = this.myMC1.getBytesLoaded();  
t = this.myMC1.getBytesTotal();  
if (t\>0 && t == l) {  
this.onEnterFrame = fadeIn;  
} else {  
trace(l/t);  
}  
};  
MovieClip.prototype.fadeIn = function() {  
if (this.myMC1.\_alpha\<100-this.fadeSpeed) {  
this.myMC1.\_alpha += this.fadeSpeed;  
} else {  
this.myMC1.\_alpha = 100;  
this.onEnterFrame = null;  
}  
};  
//change photos  
this.randomPhoto = function() {  
this.pIndex = Math.floor(Math.random()\*pArray.length);  
this.onEnterFrame = fadeOut;  
};  
interval = setInterval(this, “randomPhoto”, 3000);  
this.onEnterFrame = null;[/COLOR]

[/COLOR]
