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);