# Xml-Gallery 'multi categories', cant remove-reload thumbs

**URL:** https://forum.kirupa.com/t/xml-gallery-multi-categories-cant-remove-reload-thumbs/243371
**Category:** Uncategorized
**Created:** [November 6, 2007, 10:52am UTC](https://forum.kirupa.com/t/xml-gallery-multi-categories-cant-remove-reload-thumbs/243371 "2007-11-06T10:52:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Robyee](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@Robyee](https://forum.kirupa.com/u/Robyee)
#### Post date: [November 6, 2007, 10:52am UTC](https://forum.kirupa.com/t/xml-gallery-multi-categories-cant-remove-reload-thumbs/243371/1 "2007-11-06T10:52:56Z")

</div>

:hangover: Hi, im desperated, its 4 days im in troumble  
Basicly im tempting to modify a xml gallery with just 1 category in a “2 or more” (multi) Category the same xml gallery

First thing i’ve added at the Xml a node (splitted in 2 categories)  
At frame 9 is the Xml loading, where i let load the first category (0) :

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* frame “load xml” (9) \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
var imgArray:Array = new Array();  
var myImages:XML = new XML();  
myImages.ignoreWhite = true;

//  
function loadGallery(whichGallery) {  
rootNode = myImages.firstChild.childNodes[whichGallery].childNodes;  
var totalMenu:Number = rootNode.length;  
// Informazioni da nodo “set”  
s\_thumbWidth = int(rootNode[0].attributes.thumbWidth);  
s\_thumbHeight = int(rootNode[0].attributes.thumbHeight);  
s\_pausecountdown = int(rootNode[0].attributes.pauseCountdown);  
s\_slideSpeed = rootNode[0].attributes.slideSpeed;  
s\_autoStart = rootNode[0].attributes.autoStart;  
s\_imageScale = rootNode[0].attributes.scaleImageToFit;  
// Le immagini  
imgArray = new Array();  
for (i=1; i\<totalMenu; i++) {  
m\_big = rootNode\*.childNodes[1].firstChild.nodeValue;  
m\_small = rootNode\*.childNodes[2].firstChild.nodeValue;  
m\_title = rootNode\*.childNodes[0].firstChild.nodeValue;  
m\_desc = rootNode\*.childNodes[3].firstChild.nodeValue;  
imgArray.push([m\_big, m\_small, m\_title, m\_desc]);  
}  
gotoAndStop(“done”);  
}  
//  
myImages.onLoad = function(success) {  
loadGallery(0); // first category  
};  
myImages.load("\_xml/gal1.xml");  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

After, at frame “done” (17) the restant function to create thumbs, navigation etc. and 2 test buttons to “switch” the 2 categories

Here the actionscript with (i think) more important parts (all should be too long)

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* frame “done” (17) \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// start  
… cont …  
//  
var root:MovieClip = this;  
var totalItems:Number = imgArray.length;  
var autoStart:String = s\_autoStart;  
var imageScale:String = s\_imageScale;  
var mvSec:Number = s\_slideSpeed;  
var mvEase:Object = mx.transitions.easing.Regular.easeOut;  
var totalRounds:Number = 5_1000/50;  
var timerInc:Number = 100/totalRounds;  
var leftrightgap:Number = 100;  
var gapinmyCP:Number = 6;  
var curImage:Number = 0;  
//  
… cont …  
//  
var image:MovieClip = root.createEmptyMovieClip(“image”, root.getNextHighestDepth());  
var imageHolder:MovieClip = image.createEmptyMovieClip(“imageHolder”, image.getNextHighestDepth());  
var imageHolderDone:MovieClip = image.createEmptyMovieClip(“imageHolderDone”, image.getNextHighestDepth());  
var mainpre:MovieClip = root.attachMovie(“pre”, “mainpre”, root.getNextHighestDepth());  
trace("mainpre: "+mainpre);  
var buttons:MovieClip = root.myCP.t\_hol.createEmptyMovieClip(“buttons”, root.myCP.t\_hol.getNextHighestDepth());  
var mask:MovieClip = root.myCP.t\_hol.attachMovie(“mask”, “t\_mask”, root.myCP.t\_hol.getNextHighestDepth());  
mask.cacheAsBitmap = true;  
buttons.cacheAsBitmap = true;  
buttons.setMask(mask);  
root.myCP.swapDepths(root.getNextHighestDepth());  
root.myInfo.swapDepths(root.getNextHighestDepth()) ;  
root.lil\_img.swapDepths(root.getNextHighestDepth() );  
root.imageHolder.\_alpha = 0;  
root.imageHolderDone.\_alpha = 0;  
//  
root.lil\_img.t\_img.\_x = root.lil\_img.t\_msk.\_x=5;  
root.lil\_img.t\_img.\_y = root.lil\_img.t\_msk.\_y=5;  
root.lil\_img.t\_msk.\_width = root.s\_thumbWidth;  
root.lil\_img.t\_msk.\_height = root.s\_thumbHeight;  
root.lil\_img.t\_bg.\_width = root.s\_thumbWidth+9;  
root.lil\_img.t\_bg.\_height = root.s\_thumbHeight+10;  
root.lil\_img.t\_pointer.\_y = root.lil\_img.t\_bg.\_y+root.lil\_img.t\_bg.\_height;  
root.lil\_img.t\_pointer.\_x = root.s\_thumbWidth/2;  
root.lil\_img.\_alpha = 0;  
//  
for (i=0; i\<totalItems; i++) {  
var th:MovieClip = root.lil\_img.t\_img.createEmptyMovieClip(“t”+i, root.lil\_img.t\_img.getNextHighestDepth());  
var img:MovieClip = th.createEmptyMovieClip(“img”, th.getNextHighestDepth());  
var pre:MovieClip = th.attachMovie(“pre”, “pre”, th.getNextHighestDepth());  
 [//img.loadMovie](https://img.loadMovie)(root.imgArray_[1]);  
//trace(img);  
myLoader.loadClip(root.imgArray\*[1], img);  
th.\_x = (root.s\_thumbWidth+5)\*i;  
pre.\_x = (root.s\_thumbWidth+5)/2;  
pre.\_y = (th.\_y+root.s\_thumbHeight)/2;  
pre.\_alpha = 0;  
//  
var b:MovieClip = buttons.attachMovie(“button”, “b”+i, buttons.getNextHighestDepth());  
if (i\<9) {  
b.txt.text = “0”+(i+1);  
} else {  
b.txt.text = i+1;  
}  
b.\_x = (b.\_width+gapinmyCP)\*i;  
b.no = i;  
b.onRollOver = rollIn;  
b.onRollOut = b.onReleaseOutside=rollOt;  
b.onRelease = showImage;  
}  
root.totalbtnwidth = b.\_x+b.\_width;  
root.myCP.t\_hol.attachMovie(“inv”, “buttonsbg”, buttons.getNextHighestDepth());  
root.myCP.t\_hol.buttonsbg.onRollOver = moveLilImg;  
root.myCP.t\_hol.buttonsbg.\_y -= root.myCP.t\_hol.\_y-root.myCP.t\_bg11.\_height;  
root.myCP.t\_hol.buttonsbg.\_height = root.myCP.t\_bg.\_height;  
root.myCP.t\_hol.buttonsbg.\_width = root.totalbtnwidth;  
root.myCP.t\_hol.buttonsbg.\_alpha = 0;  
//  
showImage(root.curImage);  
listner.onResize();

// end  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

“switching” with 2 buttons

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
root.bottone\_cat\_1.onRelease = function() {  
loadGallery(0);  
showImage(0);  
};  
root.bottone\_cat\_2.onRelease = function() {  
loadGallery(1);  
showImage(0);  
};  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

The problem is that the “switching” by categories from the xml data works, but the thumbnails still the first loaded at the start  
I tryied to make some function with delete, unloadMovie(), removeMovieClip() … to, when there is the categories-change , remove the old thumbs and recreate the news one, but…nothing … its 4 days im trying …
