Hi. I need some help on a XML gallery code…The code is kindda’ finished…well, kindda…The gallery is set to load like this:
It reads the XML to store the number of thumbnails that I want to group in 3 rows and stacks of 6 (subgalleries-movieclip from the library)…so I calculate the number of subgalleries.
Then I load the thumbnails in different instances of a movieclip from the library which I want to place in the subgallery using a function with [color=darkorange]attachMovie [/color][color=black]and [color=darkorange]if…else[/color] with different conditions.[/color]
The problem is that I can’t get the attachMovie sintax right on function [color=#008000]thumbnails_fn[/color]…It doesn’t attach the movieclips from the library if I want to attach them to the subgallery…it works if I load them to the scene… :h: I can’t figure out what I’m doing wrong.
Here’s the code that I use:
[color=green]function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
thumbnails = [];
albume = [];
total = xmlNode.childNodes.length;
if(total%6==0){
_root.r=Math.round(total/6);
}else{
_root.r=Math.round((total/6)+1);
}
for(j=0; j<_root.r; j++){
albums(j);
}
a1=0;
for (a2=0; a2<_root.r; a2++) {
CA=albume[a2];
trace(CA);
for (i=a1; i<a1+6; i++) {
if(i<total){
thumbnails* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
thumbnails_fn(i,CA);
}
}
a1+=6;
}
}else {
content = “file not loaded!”;
}
}[/color]
[color=green]xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“projects.xml”);[/color]
[color=green][/color]
[color=green]/////////////////////Thumbnail Generator Code//////////////[/color]
[color=green]function thumbnails_fn(k,CAlbum){
movie=this.CAlbum.attachMovie(“obj”, “obj”+k, 500+k);
if(k>0){
if((k)%3==0){
movie._x=0;
movie._y += thisY+80;
}else{
movie._x += thisX+120;
movie._y = thisY;
}
}else{
movie._x=0;
movie._y=0;
}
thisX=movie._x;
thisY=movie._y;
movie.thumbnail.loadMovie(thumbnails[k],movie.thumbnail.getNextHighestDepth());
}[/color]
[color=green]/////////////////Album Generator Code//////////////[/color]
[color=green]function albums(h){
albumMC=this.attachMovie(“album”, “album”+h, 50+h);
albume[h]= “album”+h;
albumMC._x=0;
albumMC._y += thisYalbum+200;
thisYalbum=albumMC._y;
}[/color]
[color=#008000][/color]
[color=black]Really appreciate any help I can get![/color]