I have this kirupa xml gallery code with thumbs, but i want those thumbs in the movie clip not in the root. How should i change this code. The movie clip that the thumbs goes into is on the root and it is called holder.
function loadPic(pic) {
picture._alpha = 0;
picture.loadMovie(pic);
var temp = _root.createEmptyMovieClip("tmp", 999+d);
temp.onEnterFrame = function() {
var t = picture.getBytesTotal(), l = picture.getBytesLoaded();
preloader._visible = true;
preloader.preload_bar._xscale = 100*l/t;
if (l == t && picture._width>0 && picture._height>0) {
preloader._visible = false;
var w = picture._width+spacing, h = picture._height+spacing;
border.resizeMe(w, h);
delete this.onEnterFrame;
}
};
}
MovieClip.prototype.resizeMe = function(w, h) {
var speed = 3;
this.onEnterFrame = function() {
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
this._width = w;
this._height = h;
picture._x = this._x-this._width/2+spacing/2;
picture._y = this._y-this._height/2+spacing/2;
picture._alpha += 10;
if (picture._alpha>100) {
picture._alpha = 100;
delete this.onEnterFrame;
}
}
};
};
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
}
firstImage();
delay = setInterval(makeThumbs, 100);
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.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;
function nextImage() {
if (p<(total-1)) {
p++;
picture._alpha = 0;
loadPic(image[p]);
desc_txt.text = description[p];
picture_num();
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
loadPic(image[p]);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
picture._alpha = 0;
loadPic(image[0]);
desc_txt.text = description[0];
picture_num();
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function makeThumbs() {
thumb._visible = 0;
clearInterval(delay);
for (var i = 0; i<image.length; i++) {
var thmb = thumb.duplicateMovieClip("th"+i, getNextHighestDepth());
thmb.id = i;
thmb._x = thumb._x+(i*30);
thmb.info.text = i+1;
thmb.onRelease = function() {
showImage(this.id);
};
}
}
function showImage(d) {
picture._alpha = 0;
loadPic(image[d]);
desc_txt.text = description[d];
p = d;
picture_num();
}
spacing = 10;
picture._alpha = 0;