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.
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.
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:
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.
:: Copyright KIRUPA 2024 //--