| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
Please HELP with an XML gallery code
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 attachMovie and if...else with different conditions. The problem is that I can't get the attachMovie sintax right on function thumbnails_fn...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... I can't figure out what I'm doing wrong. Here's the code that I use: 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[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; thumbnails_fn(i,CA); } } a1+=6; } }else { content = "file not loaded!"; } } xmlData = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = loadXML; xmlData.load("projects.xml"); /////////////////////Thumbnail Generator Code////////////// 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()); } /////////////////Album Generator Code////////////// 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; } Really appreciate any help I can get! |
|
#2
|
|||
|
|||
|
hmmm
is "movie" on _root ?
try using _root.movie maybe it will do the trick... |
![]() |
| Viewing: Tutorialized Forums > Web Design & Development > XML > Please HELP with an XML gallery code |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|