Some questions about this site and picture arrays

I’ve been working with a picture array click through that calls a jpg from the server every time you click a button with a simple faid out and faid up (the code is below if your interested. Not made by me, but from the web). Sometimes there is a delay which I assume is the server or connection chocking up as it loads the jpeg (12-20k in size, ave 300x180 pix).

However, the photo album for
http://www.dirklambrechts.com/ is perfectly smooth in it’s operation, plus images are displayed at a large size, like at least 600 pix wide and dynamically grow from a thumbnail. There is never a delay on an action, and no indication that all those photo’s preloaded onto the system at launch as the site loads very quickly. Any deconstructive comments on this site and/or any of the components I mentioned greatly appriciated.

PICTURE ARRAY

this.pathToPics = “chapter2/”;

this.pArray = [“1.jpg”, “2.jpg”, “3.jpg”, “4.jpg”, “5.jpg”, “6.jpg”];
this.fadeSpeed = 20;
this.pIndex = 0;

loadMovie(this.pathToPics+this.pArray[0], photo);
MovieClip.prototype.changePhoto = function(d) {

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() {

var p = 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;
}
};

this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);

No ideas yet, but I am actually wanting to have a similar photo album setup on one of my sites, so this gives me something to start with. Let me play with it for a bit.

Also, my email is markstramaglia@yahoo.com if you want to email me stuff.

I also would like to check out that source code. I am developing a dynamic photo gallery similar to that, however, I am interfacing with VBScript and using the FileSystem object to pull from directories dynamically to create different gallerys.

this is what someone on flashkit said about this same post

“The photo album on that site either preloads ALL its images after it loads the main movie. Make a preloader function that loads an array of images one at a time, thumbs first, and call that function with setInterval(maybe at 50ms). Have 2 boolean variables, one to check whether the user is trying to download a image(ie when user clicks on a thumbnail), the other to check whether the preloader is downloading an image. The preloader function should load new image only when neither the preloader nor the user is loading anything. When the user/preloader finishes downloading an image, set their respective boolean variables back to normal. The only problem with this is that if the user clicks on an image before it’s been preloaded, the image that is currently downloading by the preloader won’t stop immediately. Then the user has to wait twice as long for an image to download. This is especially bad for dialup people because it could take them a long time to preload all your images, much longer than they would stay on your site, so you’d end up just wasting your bandwidth. The preloader script isn’t hard to make but it’s better not to use them.”

That sounds like nothing but a world of lag. I would attempt a different method. I was just wondering if you could post the source code so I could take a look at it.

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

TD

well, the lag is what the person from flashkit suggests, but if you go to the site that doesn’t seem to be an issue. The source code I don’t have as http://www.dirklambrechts.com/ is not my site, I’m just trying to reverse-engineer a nice photo album effect. As to the “photogallery” link, that’s basically what I posted above. But as I said, there is sometimes a delay. I suppose I could place each image in an .swf and put a preloader on that and just change the call action in the array.