Hello all, I’ve gotten a slideshow off the forums somewhere (can’t remember where) but I have some questions. How can I make it NOT random (just go through the array one by one)? And how do I add a counter so that once it reaches the end of the array, it will just stop? And one more thing, how can I make each image be a link to a different URL? I’d appreciate any help I can get.
Thanks a lot, here’s the code I have:
// your images folder "images"
this.pathToPics = "images/";
this.fadeSpeed = 10;
MovieClip.prototype.changePhoto = function(a) {
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() {
var p = this.photo;
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[a]);
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;
}
};
// load your textfile
myLV = new LoadVars();
myLV.onLoad = function() {
pArray = this.photoId.split(",");
// function to pick a random pic:
randomize();
};
myLV.load("photo.txt");
function randomize() {
a = Math.floor(Math.random()*(pArray.length));
changePhoto(a);
}
id = setInterval(randomize, 5000);