Hi!
I’m building this thumbnail gallery using a sample found at the web. I modified to load the amount of pictures (thumbs) I want (30) and fit it properly. I’m having problems on telling my fla that if I have MORE than 30 pictures, I want it to load just 30 and upon clicking a next button, 30 more would load ( in the same grid) and so on. So “page1” ( first grid) = pics 1 to 30, page2 31 to 60 etc.
I don’t mind loading the whole XML either, as long as I just display 30 pics at a time.
Can anyone help me?
Thank you
Here’s the code
/////////////////////////////////////////////////////////////////////////////
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
myTotal = 30;
_global.total = xmlNode.childNodes.length;
for (i=0; i<myTotal; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
thumbnails* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
thumbnailer(i);
}
}
else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
///////////////////////////////////////////////////////////////////////////////
function thumbnailer(k) {
loaded_counter = 0;
//total_thumbs = _global.total;
total_thumbs = myTotal;
var container = thumbnail_mc.createEmptyMovieClip("th"+k, thumbnail_mc.getNextHighestDepth());
container._visible = false;
container._alpha = 0;
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue;
picture.picLoader.contentPath = image[p];
//trace(image[p]);
};
target_mc.onRollOver = function() {
this._alpha = 50;
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
loaded_counter++;
counting_txt = loaded_counter;
if (loaded_counter == total_thumbs) {
main_menu.boton1._visible = true;
}
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.th"+k);
}
///////////////////////////////////////////////////////////////////////////////////////
MovieClip.prototype.grid_maker_01 = function(f) {
num = 0;
col = 5;
row = 6;
scale = 100;
space = 5;
for (l=0; l<col; l++) {
for (j=0; j<row; j++) {
//if (num<_global.total) {
if (num<30) {
with (eval("this.thumbnail_mc.th"+num)) {
_x = ((_width+space)*scale/100)*l;
_y = ((_height+space)*scale/100)*j;
_xscale = _yscale=scale;
_visible = true;
num++;
}
}
}
}
this.cascader();
};
//////////////////////////////////////////////////////////////////////////////////
MovieClip.prototype.cascader = function() {
inter = 100;
c = 0;
delayed_fade = function () {
//if (c<_global.total) {
if (c<myTotal) {
with (eval("this.thumbnail_mc.th"+c)) {
fadein();
}
c++;
trace(c);
}
else {
clearInterval(delay);
}
};
delay = setInterval(delayed_fade, inter);
};
///////////////////////////////////////////////////////////////////////////////
MovieClip.prototype.fadein = function() {
this.onEnterFrame = function() {
if (this._alpha<100) {
this._alpha = this._alpha+5;
}
else {
this._alpha = 100;
delete this.onEnterFrame;
}
};
};
///////////////////////////////////////////////////////////////////////////////////////
MovieClip.prototype.positioner = function(xDest, yDest, rDest, aDest) {
this.onEnterFrame = function() {
this._x = xDest-(xDest-this._x)/1.2;
this._y = yDest-(yDest-this._y)/1.2;
this._alpha = aDest-(aDest-this._alpha)/1.2;
this._rotation = rDest-(rDest-this._rotation)/1.2;
if ((Math.abs(xDest-this._x)<=1) and (Math.abs(yDest-this._y)<=1)) {
delete this.onEnterFrame;
this._x = xDest;
this._y = yDest;
this._alpha = aDest;
this._rotation = rDest;
}
};
};
}