Photo Gallery problem

Folks,

First, thanks Kirupa for a great tutorial about the Flash MX Photo Gallery! Now I’m having one problem - the images aren’t being displayed properly. Logically, it seems that Flash is assuming that their registration point is the upper left, as that corner seems to be in the middle of the gallery. How is this fixed? Check out [COLOR=orange]my prototype gallery here[/COLOR]. I’ve also uploaded a copy of the .fla to peruse.

Also, the images are NOT being resized. Only the upper left corner can be seen.

Any help, as always, is appreciated.

best regards,

Arp Laszlo

paste this script:

MovieClip.prototype.centered = function(x, y) {
	this._x = x-this._width/2;
	this._y = y-this._height/2;
};

and add this line here:

MovieClip.prototype.loadMeter = function() {
	var i, l, t;
	l = this.photo.getBytesLoaded();
	t = this.photo.getBytesTotal();
	if (t>0 && t == l) {
		this.onEnterFrame = fadeIn;
		**this.photo.centered(x, y);**
	} else {
		trace(l/t);
	}
};

change the parameters x and y to suit your needs. ie.

// if you want it centered at x:150 y:220
this.photo.centered(150, 220);

=)

Thanks for the tips. Oddly, the first picture is still like that, but the following ones are in the right place but you can only see their lower right corner. I’m gonna play around and get this thing right…

Arp

OK - I just moved the movie clip until it looked right. I tried messing with the code you suggested, tried messing with reg point, etc, to no avail.

However, moving the movie clip was really easy, so I can’t complain. Still, thanks for your advice!

Arp

:stunned: :stuck_out_tongue:

is it possible to make the script so i resizes the picture to fit in the photo frame?

Thanks.

also, how do you make it so when it doesnt find an image, it goes back to the first image, like a loop. Right now when it doesnt find an image it just outputs “0” infinitely.

I still need an answer. Like, really badly…

Thanks

Is the outputting of the zero when you’re testing the movie in flash? i found that it didn’t work right when testing, but it worked fine when uploaded to my webpage. I didn’t need any extra code to make the gallery loop.

ok, thats good to know, and yes, it was when i was testing. Thanks.

oops… i missed this thread. :stuck_out_tongue:

anyway, here’s something really easy, no maths required. :wink:

MovieClip.prototype.resize = function(wMax, hMax) {
	while (this._width>wMax || this._height>hMax) {
		this._xscale = this._yscale -= 1;
	}
};
myMovieClip.resize(wMax, hMax);

just specify wMax (maximum width) and hMax (maximum height) and the MovieClip will be scaled proportionally. :wink:

execelent dude. thanks ALOT! :slight_smile: :slight_smile:

no problem, grayson. :wink:

Hi…this is catnip…

I just got the same problem like Arp, and plus when I applied it to my pictures it didn’t show anything on the screen.

Then I added the code from Kax, but the first image still dosent in the right place (by using the photos along with source file). Moreover, I cannt even see any of my images to be shown in the placeholder(an empty movie clip).

Can you tell what’s wrong with this?

think maybe I should try doing this with javascript…