# Adding buttons to this slideshow

**URL:** <https://forum.kirupa.com/t/adding-buttons-to-this-slideshow/273530>\
**Category:** Uncategorized\
**Created:** [October 16, 2008, 2:26pm UTC](https://forum.kirupa.com/t/adding-buttons-to-this-slideshow/273530 "2008-10-16T14:26:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricoboxing](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@ricoboxing](https://forum.kirupa.com/u/ricoboxing)\
**Post date:** [October 16, 2008, 2:26pm UTC](https://forum.kirupa.com/t/adding-buttons-to-this-slideshow/273530/1 "2008-10-16T14:26:22Z")

</div>

hello, i’ve used kirupa’s slideshow which was modified here by hondo311. how would i go about adding buttons to the scene so that the user can jump to a certain image? heres the actionscript.

var delay:Number = 1000;  
var init:Boolean = false;

var top:MovieClip = picture;  
var bot:MovieClip = picture2;

//-----------------------  
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();  
} else {  
content = “file not loaded!”;  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“exteriors.xml”);  
p = 0;

function fadeIn() {  
//swap();  
onEnterFrame = function() {  
filesize = top.getBytesTotal();  
loaded = top.getBytesLoaded();  
if (loaded != filesize) {  
preloader.\_visible = true;  
preloader.preload\_bar.\_xscale = 100\*loaded/filesize;  
} else {  
preloader.\_visible = false;  
if (top.\_alpha \< 100) {  
top.\_alpha +=5;  
}else{  
delete onEnterFrame;  
slideshow();  
}  
}  
};  
};

function fadeOut() {  
onEnterFrame = function() {  
if (top.\_alpha \> 5) {  
top.\_alpha -=5;  
}else{  
top.\_alpha = 0;  
delete onEnterFrame;  
nextImage();  
}  
};  
};

function nextImage() {  
if (p\<(total-1)) {  
p++;  
top.\_alpha = 0;  
top.loadMovie(image[p]);  
desc\_txt.text = description[p];  
picture\_num();  
fadeIn();  
}  
};

function firstImage() {  
init = true;  
top.\_alpha = 0;  
top.loadMovie(image[0]);  
desc\_txt.text = description[0];  
picture\_num();  
fadeIn();  
};

function picture\_num() {  
current\_pos = p+1;  
pos\_txt.text = current\_pos+" / "+total;  
};

function slideshow() {  
myInterval = setInterval(pause\_slideshow, delay);  
function pause\_slideshow() {  
clearInterval(myInterval);  
if (p == (total-1) && !init) {  
p = 0;  
firstImage();  
} else if (p == (total-1) && init) {  
p = -1;  
swap();  
}else{  
swap();  
}  
}  
};

function swap(){  
var t = top;  
top.swapDepths(bot);  
top = bot;  
bot = t;  
nextImage();  
}
