# Photo Gallery Help!

**URL:** <https://forum.kirupa.com/t/photo-gallery-help/159651>\
**Category:** Uncategorized\
**Created:** [August 18, 2005, 11:54pm UTC](https://forum.kirupa.com/t/photo-gallery-help/159651 "2005-08-18T23:54:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eac81](https://avatars.discourse-cdn.com/v4/letter/e/c67d28/32.png) [@eac81](https://forum.kirupa.com/u/eac81)\
**Post date:** [August 18, 2005, 11:54pm UTC](https://forum.kirupa.com/t/photo-gallery-help/159651/1 "2005-08-18T23:54:12Z")

</div>

I’m relatively new to flash and trying to create “header” photo gallery. I followed your tutorial on how to do this and it isn’t working right. I can’t figure out what’s wrong. I’m not sure if I’ve changed all the code that needs to be changed. The first image just pops up in a totally different place than I had the movie clip positioned and none of the photos are rotating.

Here is what my code is reading now (I copied and pasted the code from the tutorial and changed out the appropriate image names and website path):

[color=gray]//Code written by sbeener (suprabeener)  
/\*  
i wrote this code, but you can use and abuse it however you like.  
the methods are defined in the order which they occur to make it  
easier to understand.  
\*/  
// 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 = “[/color][[color=gray]http://www2.cybergolf.com/kemper/images/159/[/color]](http://www2.cybergolf.com/kemper/images/159/)[color=gray]”;  
// fill this array with your pics  
this.pArray = [“image1.jpg”, “image2.jpg”, “image3.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.photo);  
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.photo.\_alpha\>this.fadeSpeed) {  
this.photo.\_alpha -= this.fadeSpeed;  
} else {  
this.loadPhoto();  
}  
};  
MovieClip.prototype.loadPhoto = function() {  
// specify the movieclip to load images into  
var p = \_root.photo;  
//------------------------------------------  
p.\_alpha = 0;  
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);  
this.onEnterFrame = loadMeter;  
};  
MovieClip.prototype.loadMeter = function() {  
var i, l, t;  
l = this.photo.getBytesLoaded();  
t = this.photo.getBytesTotal();  
if (t\>0 && t == l) {  
this.onEnterFrame = fadeIn;  
} else {  
trace(l/t);  
}  
};  
MovieClip.prototype.fadeIn = function() {  
if (this.photo.\_alpha\<100-this.fadeSpeed) {  
this.photo.\_alpha += this.fadeSpeed;  
} else {  
this.photo.\_alpha = 100;  
this.onEnterFrame = null;  
}  
};  
// Actions -----------------------------------------  
// these aren’t necessary, just an example implementation  
this.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
this.changePhoto(-1);  
} else if (Key.getCode() == Key.RIGHT) {  
this.changePhoto(1);  
}  
};  
Key.addListener(this);[/color]

[color=black]Here is the link to the flash file on the web: [/color][[color=black]http://www2.cybergolf.com/kemper/courses/layout9.asp?id=159&page=2597[/color]](http://www2.cybergolf.com/kemper/courses/layout9.asp?id=159&page=2597)[color=black]. I know I’m probably doing something dumb, but I’d appreciate any help I can get! I’m still learning! Thanks![/color]
