I have this SlideShow-Script from somewhere here.
I would like to add buttons for each picture, I mean btn1 for loading picture1, btn2 for picture2 and so on.
I tried in different ways, the most logical to me seemed to be:
btn1.onRelease = function() {
preloadPic(1)
this.desc_txt.text = description[p];
picture_num();
};
but nothing works.
Thats the SlideShowScript:
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;
}
id = setInterval(preloadPic, 100);
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images1.xml");
var p = 0;
var current;
var k = 0;
// height and width of the square box holding the images
var imgBoxWidth = 600;
var imgBoxHeight = 600;
function preloadPic() {
clearInterval(id);
var con = picture.duplicateMovieClip("con"+k, 9984+k);
con.loadMovie(image[p]);
preloader._visible = 1;
preloader.swapDepths(con.getDepth()+3);
con._alpha = 0;
var temp = _root.createEmptyMovieClip("temp"+k, 99+k);
k++;
temp.onEnterFrame = function() {
var total = con.getBytesTotal();
var loaded = con.getBytesLoaded();
percent = Math.round(loaded/total*100);
preloader.preload_bar._xscale = percent;
if (con._width) {
con._x += (imgBoxWidth - con._width) / 2
con._y += (imgBoxHeight - con._height) / 2
preloader._visible = 0;
con.onEnterFrame = fadeIn;
delete this.onEnterFrame;
}
};
}
MovieClip.prototype.fadeIn = function() {
if (this._alpha<100) {
current._alpha -= 10;
this._alpha += 10;
} else {
current._visible = 0;
current = this;
delete this.onEnterFrame;
}
};
function nextImage() {
p<total-1 ? (p++, preloadPic()) : null;
this.desc_txt.text = description[p];
picture_num();
}
function prevImage() {
p>0 ? (p--, preloadPic()) : null;
this.desc_txt.text = description[p];
picture_num();
}
function picture_num() {
current_pos = p+1;
this.pos_txt.text = current_pos+" / "+total;
}
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
So how should I formulate the onRelease function?
Thanks for helping!