PDA

View Full Version : Photo Gallery tutorial help



Hakmed
March 27th, 2003, 05:47 PM
Using MX!

So I'm a bigtime newbee to actionscript... and man... it's alot tougher than I thought. Anyways, I was going through the photo gallery tutorial and I'm trying to customize it to fit my needs.

I have some thumbnails scrolling across the bottom and each thumbnail is a button w/ the following action:


on (release) {
_root.changePhoto("1.gif");
}


so I'm basically setting the path to the larger size pic in the action of the thumbnail button.

In the main actions layer, I have the following:


this.fadeSpeed = 20;
this.pathToPics = "pics/";
MovieClip.prototype.changePhoto = function (d) {
this.onEnterFrame = fadeOut(d);
};
MovieClip.prototype.fadeOut = function(d) {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto(d);
}
};
MovieClip.prototype.loadPhoto = function(d) {
// specify the movieclip to load images into
var p = _root.photo;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+d);
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;
}
};


Now what I'm thinking, is that whenever I click the thumbnail of the pic I wanna view on the "photo" movie clip, the previous pic will fade out and the new pic will fade in. But it doesn't work!

Any advice will help ALOT! THank you!

morse
March 27th, 2003, 05:52 PM
hey bud, can you put that in the actionscript tags?

Hakmed
March 27th, 2003, 06:00 PM
done

morse
March 27th, 2003, 06:04 PM
Thank you :). Doubt if I can help but I'll try.

morse
March 27th, 2003, 06:10 PM
Well you dont have any of the array code in there. Do you have that in your flash movie?

Hakmed
March 27th, 2003, 06:43 PM
Actually, I was trying to pass the filename from the thumbnail button action:


on (release) {
_root.changePhoto("1.gif");
}


...instead of using an array index. I thought I had removed the array dependency from the script. Did I leave something in the code in my first post that references an array?

morse
March 27th, 2003, 08:18 PM
Dont think so, I was just wondering where it went. Anyway, I'm afraid I cant help you, but maybe the author can, or a number of other mods.

Hakmed
March 28th, 2003, 01:04 PM
Alright. Thanks anyway!

dimitry
March 29th, 2003, 08:41 AM
Hi, I'm not a super coder, here. But I think you should try with standard .jpg file before assuming the problem is with your code. Flash can't laod exteral .gifs or progressive .jpegs, I believe...