Photo Gallery question

I used the Photo Gallery tutorial found at http://www.kirupa.com/developer/mx/photogallery.htm to create a slideshow. However, it’s not bringing up the pictures. I chose not to use the buttons so I’m assuming the pictures fade in and fade out automatically. Am I right to assume this? Here’s the code I’ve got, it’s the same as what is in the tutorial except for the folder and the filenames. Was I supposed to change anything else?

Thanks for your help!

// put the path to your pics here, include the slashes (ie. “pics/”)
// leave it blank if they’re in the same directory
this.pathToPics = “”;
// fill this array with your pics
this.pArray = [“cdc.gif”, “denmark_royalty_library.gif”, “navy.gif”, “niehs.gif”, “saic.gif”, “san_diego.gif”, “shell.gif”, “standards_council_canada.gif”, “three_valleys.gif”, “tmobile.gif”, “us_census_bureau.gif”];
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;
}
};

The code as you have it now will only show the first picture because of this line

loadMovie(this.pathToPics+this.pArray[0], _root.photo);

But no other functions are being called…
To get what you’re after you have to use setInterval() (look it up in your AS dictionary;) ).
In your case put

setInterval(this, "changePhoto", 5000, 1);

at the bottom of your code, the 5000 are in msecs:)

scotty(-:

Thanks Scotty,
I’m pretty new at all this, was I supposed to put setInterval right under loadMovie? Also, for some reason, not even the first image loads when I test the movie. Do you know why that could be?

Aah silly me:stunned:
You can’t load gifs dynamically, just jpegs…
And that code (the setInterval) at the bottom (the end) of all your code:)

scotty(-:

And, if you resave them as jpg, be sure you save them as non-progressive;)

scotty(-:

Wow, that worked very well. Thanks sooooo much!!!

One last question, this is pickiness on my part. when each image fades in and out it shifts about 1 pixel to the right then when it’s in place, it shifts about one pixel to the left.

Could that just be the position of the movie?

No it’s Flash;)
Try setting the final alpha to 99 or 98…
So in the fadeIn prototype after the else statement

this.photo._alpha = 98;

scotty(-:

yeah, that worked!! thanks, you’ve been very helpful, i really appreciate it.

no problem=) and welcome to kirupaforum btw;)

scotty(-: