# Kirupa slideshow with a twist

**URL:** <https://forum.kirupa.com/t/kirupa-slideshow-with-a-twist/166574>\
**Category:** open source\
**Created:** [October 20, 2005, 11:34pm UTC](https://forum.kirupa.com/t/kirupa-slideshow-with-a-twist/166574 "2005-10-20T23:34:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)\
**Post date:** [October 20, 2005, 11:34pm UTC](https://forum.kirupa.com/t/kirupa-slideshow-with-a-twist/166574/1 "2005-10-20T23:34:49Z")

</div>

Was farting around being bored. Came up with this. Feel free to use for whatever.  
[**Preview here**](http://2210media.com/test/slide/)

Files are attached

edit: Slide show code is straight from the tutorial. I dont take credit for it.  
The rest is mine however 😉

---

<div class="post-metadata">

**Author:** ![JBN](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jbn/32/2239_2.png) [@JBN](https://forum.kirupa.com/u/JBN)\
**Post date:** [March 21, 2006, 12:41am UTC](https://forum.kirupa.com/t/kirupa-slideshow-with-a-twist/166574/2 "2006-03-21T00:41:49Z")

</div>

On the same topic, how would you simply keep the image centered without the sliding, and on a specific sized stage. I’ve been playing around the with the code all day, and nothing seems to be working. I’ve got the XML gallery all working, I just need the images to center on the x-axis for different sized images such as verticals. Thanks!

Here is what I have working right now with xml gallery modified for crossfades (from the tutorials).

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(“images.xml”);  
var loadTot = 0;  
var k = 0;  
// ///////////////////////////////////  
function preloadPic() {  
clearInterval(id);  
var con = picture.duplicateMovieClip(“con”+k, 9984+k);  
con.loadMovie(image[k]);  
var temp = \_root.createEmptyMovieClip(“temp”+k, 99+k);  
temp.onEnterFrame = function() {  
var total = con.getBytesTotal();  
var loaded = con.getBytesLoaded();  
percent = Math.round((loaded/total\*100)/image.length);  
preloader.preload\_bar.\_xscale = loadTot+percent;  
info.text = “Loading picture “+k+” of “+image.length+” total”;  
if (loaded == total && total\>4) {  
con.\_visible = 0;  
nextPic();  
loadTot += percent;  
delete this.onEnterFrame;  
}  
};  
}  
function nextPic() {  
if (k\<image.length-1) {  
k++;  
preloadPic();  
} else {  
firstImage();  
preloader.\_visible = 0;  
info.text = “”;  
}  
}  
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();  
};  
// ///////////////////////////////////  
var p = 0;  
var current;  
MovieClip.prototype.fadeIn = function() {  
if (this.\_alpha\<100) {  
current.\_alpha -= 10;  
this.\_alpha += 10;  
} else {  
current.\_visible = 0;  
delete this.onEnterFrame;  
}  
};  
function nextImage() {  
if (p\<(total-1)) {  
current = this[“con”+p];  
p++;  
var picture = this[“con”+p];  
picture.\_visible = 1;  
picture.\_alpha = 0;  
picture.onEnterFrame = fadeIn;  
desc\_txt.text = description[p];  
picture\_num();  
}  
}  
function prevImage() {  
if (p\>0) {  
current = this[“con”+p];  
p–;  
var picture = this[“con”+p];  
picture.\_visible = 1;  
picture.\_alpha = 0;  
picture.onEnterFrame = fadeIn;  
desc\_txt.text = description[p];  
picture\_num();  
}  
}  
function firstImage() {  
con0.\_visible = 1;  
con0.\_alpha = 0;  
con0.onEnterFrame = fadeIn;  
desc\_txt.text = description[0];  
picture\_num();  
}  
function picture\_num() {  
current\_pos = p+1;  
pos\_txt.text = current\_pos+" / "+total;  
}
