# Xml slideshow - jog thumbnail

**URL:** <https://forum.kirupa.com/t/xml-slideshow-jog-thumbnail/225238>\
**Category:** Uncategorized\
**Created:** [May 9, 2007, 10:39pm UTC](https://forum.kirupa.com/t/xml-slideshow-jog-thumbnail/225238 "2007-05-09T22:39:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwertybloke](https://avatars.discourse-cdn.com/v4/letter/q/cdc98d/32.png) [@qwertybloke](https://forum.kirupa.com/u/qwertybloke)\
**Post date:** [May 9, 2007, 10:39pm UTC](https://forum.kirupa.com/t/xml-slideshow-jog-thumbnail/225238/1 "2007-05-09T22:39:44Z")

</div>

I have adapted the kirupa xml slideshow tutorial.

However I would like to create a up and down buttons that jog the thumbnails + or - 3 thumb images either way.

Is this a case of creating an on (release) action that tells the slider to advance a specified distance??

## Here’s the actionscript:

function loadPhotoXML(filename)  
{  
PhotoXML.ignoreWhite = true;  
PhotoXML.load(filename);  
PhotoXML.onLoad = function (success)  
{  
if (success)  
{  
PhotoNumber = 0;  
RootNode = this.firstChild;  
TotalPhotos = RootNode.childNodes.length;  
thumbnails = [];  
for (i = 0; i \< TotalPhotos; i++)  
{  
thumbnails\* = RootNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
thumbnails\_fn(i);  
} // end of for  
showPhoto(PhotoNumber);  
} // end if  
};  
} // End of the function  
function showPhoto(PhotoNum)  
{  
if (PhotoNum == TotalPhotos - 1)  
{  
next\_btn.enabled = false;  
}  
else  
{  
next\_btn.enabled = true;  
} // end else if  
if (PhotoNum == 0)  
{  
previous\_btn.enabled = false;  
}  
else  
{  
previous\_btn.enabled = true;  
} // end else if  
if (loaded == filesize)  
{  
var \_loc2 = RootNode.childNodes[PhotoNum].attributes.filename;  
var \_loc3 = RootNode.childNodes[PhotoNum].firstChild.nodeValue;  
empty\_mc.loadMovie(“gallery/images/” + \_loc2);  
caption\_txt.text = \_loc3;  
} // end if  
} // End of the function  
function nextImage()  
{  
if (p \< TotalPhotos - 1)  
{  
PhotoNumber = PhotoNumber + 1;  
if (loaded == filesize)  
{  
empty\_mc.\_alpha = 0;  
showPhoto(PhotoNumber);  
} // end if  
} // end if  
} // End of the function  
function prevImage()  
{  
PhotoNumber = PhotoNumber - 1;  
showPhoto(PhotoNumber);  
} // End of the function  
function thumbNailScroller()  
{  
this.createEmptyMovieClip(“tscroller”, 1000);  
scroll\_speed = 5;  
tscroller.onEnterFrame = function ()  
{  
if (\_root.\_xmouse \>= thumbnail\_mc.\_x && \_root.\_xmouse \<= thumbnail\_mc.\_x + thumbnail\_mc.\_width)  
{  
if (\_root.\_ymouse \>= hit\_right.\_y - 40 && thumbnail\_mc.hitTest(hit\_right))  
{  
thumbnail\_mc.\_y = thumbnail\_mc.\_y - scroll\_speed;  
}  
else if (\_root.\_ymouse \<= hit\_left.\_y + 40 && thumbnail\_mc.hitTest(hit\_left))  
{  
thumbnail\_mc.\_y = thumbnail\_mc.\_y + scroll\_speed;  
} // end else if  
}  
else  
{  
delete tscroller.onEnterFrame;  
} // end else if  
};  
} // End of the function  
function thumbnails\_fn(k)  
{  
thumbnail\_mc.createEmptyMovieClip(“t” + k, thumbnail\_mc.getNextHighestDepth());  
tlistener = new Object();  
tlistener.onLoadInit = function (target\_mc)  
{  
target\_mc.\_y = hit\_left.\_y + (  
eval(“thumbnail\_mc.t” + k).\_height + 8) \* k;  
target\_mc.pictureValue = k;  
target\_mc.onRelease = function ()  
{  
PhotoNumber = this.pictureValue - 1;  
nextImage();  
};  
target\_mc.onRollOver = function ()  
{  
this.\_alpha = 50;  
thumbNailScroller();  
};  
target\_mc.onRollOut = function ()  
{  
this.\_alpha = 100;  
};  
};  
image\_mcl = new MovieClipLoader();  
image\_mcl.addListener(tlistener);  
image\_mcl.loadClip(thumbnails[k], “thumbnail\_mc.t” + k);  
} // End of the function  
p = 0;  
var PhotoXML = new XML();  
var PhotoNumber;  
var TotalPhotos;  
var RootNode;  
loadPhotoXML(“images\_SS07.xml”);  
listen = new Object();  
listen.onKeyDown = function ()  
{  
if (Key.getCode() == 37)  
{  
prevImage();  
}  
else if (Key.getCode() == 39)  
{  
nextImage();  
} // end else if  
};  
this.onEnterFrame = function ()  
{  
filesize = empty\_mc.getBytesTotal();  
loaded = empty\_mc.getBytesLoaded();  
preloader.\_visible = true;  
if (loaded != filesize)  
{  
preloader.preload\_bar.\_xscale = 100 \* loaded / filesize;  
}  
else  
{  
preloader.\_visible = false;  
if (empty\_mc.\_alpha \< 100)  
{  
empty\_mc.\_alpha = empty\_mc.\_alpha + 10;  
} // end if  
} // end else if  
};  
Key.addListener(listen);  
previous\_btn.onRelease = function ()  
{  
prevImage();  
};  
next\_btn.onRelease = function ()  
{  
nextImage();  
};

* * *

Help much appreciated

:hugegrin:
