: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 = 51000/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(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 …