Hey people
I’ve been trying to add more galleries the [URL=“http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm”]Kirupa Photo Gallery
but so far unsuccessfull - i’ve modified things alittle, but it’s mostly the same.
function loadXML(loaded) {
if (loaded) {
image = [];
gal = [];
xmlNode = this.firstChild.firstChild;
gtotal = this.firstChild.childNodes.length;
total = xmlNode.childNodes.length;
tx = 5;
gx = 5;
for (n=0; n<gtotal; n++) {
gal* = xmlNode.childNodes[n].attributes.no
_root.gholder.attachMovie("gallery","gallery"+n,n);
_root.gholder["gallery"+n]._x = gx;
_root.gholder["gallery"+n]._y = 10;
_root.gholder["gallery"+n].gindex = n;
gx += 15.5;
}
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.attributes.jpegURL
_root.tholder.attachMovie("thumb","thumb"+i,i);
_root.tholder["thumb"+i]._x = tx;
_root.tholder["thumb"+i]._y = 0;
_root.tholder["thumb"+i].tindex = i;
tx += 15.5;
//currentSlideNode = currentSlideNode.nextSibling;
//thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("album.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
The xml is alittle different too
<?xml version="1.0" encoding="UTF-8"?>
<images>
<Gallery no="a">
<slideNode jpegURL="http://www.kirupa.com/developer/mx2004/pg/kresge.jpg"/>
<slideNode jpegURL="http://www.kirupa.com/developer/mx2004/pg/medialab.jpg"/>
<slideNode jpegURL="http://www.kirupa.com/developer/mx2004/pg/stata_lobby.jpg"/>
<slideNode jpegURL="http://www.kirupa.com/developer/mx2004/pg/construction.jpg"/>
</Gallery>
<Gallery no="b">
<slideNode jpegURL="http://www.kirupa.com/developer/mx2004/pg/structure_sm.jpg"/>
<slideNode jpegURL="http://www.kirupa.com/developer/mx2004/pg/glass.jpg"/>
<slideNode jpegURL="http://www.kirupa.com/developer/mx2004/pg/construction.jpg"/>
</Gallery>
<Gallery no="c">
<slideNode jpegURL="http://www.kirupa.com/developer/mx2004/pg/medialab.jpg"/>
<slideNode jpegURL="http://www.kirupa.com/developer/mx2004/pg/stata_lobby.jpg"/>
<slideNode jpegURL="http://www.kirupa.com/developer/mx2004/pg/construction.jpg"/>
</Gallery>
</images>
This is as far as i can get before i get errors i cant get out by displaying image* in gallery[n].
at the current time i can only get the number of galleries and display the images in the first gallery - not change between galleries.
I would really appreciate if someone would help writing some
thing that would update the gallery-index properly and make the image for-loop look inside that gallery[n].
Hoping for quick responses.
Thanks for this most informative community
:kir:Penney