# Photo Gallery Tutorial not working

**URL:** https://forum.kirupa.com/t/photo-gallery-tutorial-not-working/20457
**Category:** flash
**Created:** [May 8, 2003, 7:45pm UTC](https://forum.kirupa.com/t/photo-gallery-tutorial-not-working/20457 "2003-05-08T19:45:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dirtbikephil](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@dirtbikephil](https://forum.kirupa.com/u/dirtbikephil)
#### Post date: [May 8, 2003, 7:45pm UTC](https://forum.kirupa.com/t/photo-gallery-tutorial-not-working/20457/1 "2003-05-08T19:45:48Z")

</div>

I’ve tried following the Photo Gallery tutorial on this site but for some reason mine is not working. Please help. I’m using Flash 5 by the way if that matters.

Thanks.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 9, 2003, 9:27am UTC](https://forum.kirupa.com/t/photo-gallery-tutorial-not-working/20457/2 "2003-05-09T09:27:28Z")

</div>

The tutorial about the photo gallery is only applicable to flash MX cause the coding system of Flash 5 and Flash MX is different. But I think you could modify the codes a little so that it will work in flash 5. Unfortunately I don’t know how to modify it. Maybe someone can help you how to modify the code. 🙂

Hope I answered you question. :beam:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 10, 2003, 2:29pm UTC](https://forum.kirupa.com/t/photo-gallery-tutorial-not-working/20457/3 "2003-08-10T14:29:38Z")

</div>

I have just run into this same problem. I need to keep this published as Flash 5 so I notice I need to modify the actionscript as well. I think it has something to do with addListener at the end of the code:

// 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 = “pics/”;  
// fill this array with your pics  
this.pArray = [“01.jpg”, “02.jpg”, “03.jpg”, “04.jpg”, “05.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);

What actually is not working are the previous/next buttons. They don’t flip the image to the previous/next jpgs… but stay on the 1st one. The button code is simply:

on (release) {  
\_root.changePhoto(1);   
}

Anyway, does anyone know how to modify this code to work with Flash 5 instead of MX? I’m really desperate! Thanks in advance.
