Need help making a photo gallery

Well, I thought I had it playing automatically. Where does the setInterval need to be? I’m not that good with as.

At the end of your code put this

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

the 3000 is the time in msecs:)

scotty(-:

I almost had it. I did not have the changePhoto in the setInterval. Thanks…working.

welcome;)

Hi, scotty!

I got similar problem with as ajaxx’s. i followed the same tutorial and couldn’t make it work.:-/ at some point, the photo actually showed up, but the button didn’t work. and then the button work, but the photo wasn’t in the right place (it always showed up at the bottom of the masked layer).

attached what i got. hope u can help me. thanks a lot!

Thank you so much for this tutorial… it’s a life saver!!!
Well, it works fine for me … but what I want to know is:

I have some humongous images … over 1000*1000 pixles in dimension.
How do we make the code resize each image to fit within the mask ?
Don’t tell me I have to resize every single picture!!!

http://www.kirupa.com/developer/mx/photogallery.htm

@liltea, the photo mc’s registrationpoint should be topleft, you had it in middle left and you’ve scaled it, so the picture gets scaled as well:)
The pictures in your folder had a .jpg.jpg extension and if you use text in your buttons, uncheck the selectable option…
I’ve attached the fixed fla;)

scotty(-:

@axelmurillo, you can scale them after the picture is fully loade, so just before the fadeIn function, but…why load such a big picture?
If resize them before you load them (in eg Photoshop) the loading time will be much less and your audience much more happy;)

scotty(-:

Thanks a lot, scotty!

but, i can’t open the .swf file… it says “unexpected file format” :frowning:

Here it is again:)

scotty(-:

aaah… Thanks a lot!! :smiley:

no problem:thumb:

Oh wow … my audience won’t mind!!! (and we’ll all work so much less!!)
see, i have about 500 images in a bunch of different albums… about 30-50
and i wanna upload them all using this tutorial.
could you please tell me how to scale it after it loads? i don’t know
how to edit actionscript. i know cut and paste!
:rabbit:
i appreciate your help so!!!

thanks

Change the loadMeter prototype in this:

MovieClip.prototype.loadMeter = function() {
	var i, l, t;
	l = this.photo.getBytesLoaded();
	t = this.photo.getBytesTotal();
	if (t>0 && t == l && this.photo._width>0 && this.photo._height>0) {
		//change the "25" to the value you want
		this.photo._xscale = this.photo._yscale=25;
		this.onEnterFrame = fadeIn;
	} else {
		trace(l/t);
	}
};

?

scotty(-:

thank you so so much scotty!!! i’m gonna do that as soon as i get back to my
own computer!!! thanks!!

wecome=)

heya scotty!!! i did it!!! and it works!!! thank you so much!
there’s just one little glitch that i cannot understand…

now it loads the very first image … HUGE… and the rest then resize…
how do i make it so that it loads that first image resized already. ???

The whole code I ended up with (with all of your help!! :D) goes like this:


/*
i wrote this code, but you can use and abuse it however you like.
the methods are defined in the order which they occur to make it
easier to understand.
*/
// 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 = “DerbyDaysDinnerSpring04/”;
// fill this array with your pics
this.pArray = [“image1.jpg”, “image2.jpg”, “image3.jpg”, “image4.jpg”, “image5.jpg”, “image6.jpg”, “image7.jpg”, “image8.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.photo._width>0 && this.photo._height>0) {
//change the “25” to the value you want
this.photo._xscale = this.photo._yscale=25;
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);


Help ?? Thank you so much!!!

I see:)
Look for this line in your code

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

This loading the first picture, but directly, without the use of the fade in and thus without the resizing…
Skip that line and put at the bottom of your code:

this.changePhoto(0)

scotty(-:

you are a total GODSEND!!! THANK YOU SOOOOOOOOOOOOO MUCH.
soon as i put this online i’ll post the link so you can see how i did :slight_smile:
THANK YOU THANK YOU THANK YOU

no problem:lol: