-
[F8] photo gallery with external photos and .txt
Hello,
I've developed a photo gallery with external files (.jpg's and one .txt with the total number of photos). In this gallery you can see 12 thumbnails of the photos. This is the code in the .swf:
numero4=new LoadVars();
numero4.load("galerias/" + n + "/galerias.txt");
numero4.onLoad=function(){
for(i=1; i<=numero4.num; i++){
var img2=_root.caja2.attachMovie("galeria2","gal" + i, i);
if(i%2==0){
eval("caja2/gal" + i)._x=70;
}else{
eval("caja2/gal" + i)._x=5;
}
eval("caja2/gal" + i)._y=(Math.ceil(i/2)*60)-60;
//cargamos imagenes
loadMovie("galerias/" + n + "/" + i + ".jpg", img2);
img2._xscale=23;
img2._yscale=23;
}
}
numero5=new LoadVars();
numero5.load("galerias/" + n + "/galerias.txt");
numero5.onLoad=function(){
for(j=1; j<=numero5.num; j++){
var boton2=_root.caja2.attachMovie("boton_gal2", j, j+100);
if(j%2==0){
eval("caja2/" + j)._x=70;
}else{
eval("caja2/" + j)._x=5;
}
eval("caja2/" + j)._y=(Math.ceil(j/2)*60)-60;
loadMovie("galerias/" + n + "/1.jpg", "contenedor_mc");
boton2.onRelease=function(){
n2=this._name;
loadMovie("galerias/" + n + "/" + n2 +".jpg", "contenedor_mc");
}
}
}
The problem is when I have more than 12 photos. I've loaded all the photos but it is only shown 12 thumbnails. I want to create 2 buttons that allow show the thumbnails in this way: 1-12 or 13-24 or 25-36, etc. I think this could be done if the button call a function that increases or decreases the value of the variable (i). I can't achieve it!!!!!!!
Thanks in advance
-
@ aran: please ignore that previous advertisement- he wants money from it and actually is only helping himself.
Do something like this:
Code:
function showThumbnails(pageNr){
var perPage = 12;//thumbnails allowed per page
var totalImages = 43;//the total amount of images...
var startAt = (pageNr-1)*perPage+1;//where to start at nr..
var endAt = startAt+(perPage-1); //where to stop at nr...
if (endAt > totalImages){//limit checker,- check if the end postion doesnt exceed the total images
endAt = totalImages;
}
for (var i=startAt; i <= endAt;i++){
trace("load image myImage"+i+".jpg");
}
}
showThumbnails(1);
feel free to ask for details or addtional explainations here without the need to pay
-
Hello,
I've find a solution but I´ll study your code. Probably it will help me in the future.
Thanks a lot
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|