# Preload xml image in slideshow

**URL:** <https://forum.kirupa.com/t/preload-xml-image-in-slideshow/251468>\
**Category:** Uncategorized\
**Created:** [February 8, 2008, 8:02pm UTC](https://forum.kirupa.com/t/preload-xml-image-in-slideshow/251468 "2008-02-08T20:02:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonbaum](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@jasonbaum](https://forum.kirupa.com/u/jasonbaum)\
**Post date:** [February 8, 2008, 8:02pm UTC](https://forum.kirupa.com/t/preload-xml-image-in-slideshow/251468/1 "2008-02-08T20:02:06Z")

</div>

Hi,

In order to decrease the delay between pictures in my xml slideshow, I would like to preload the next image in the background so that when the use clicks the next button there is now delay. I am not sure exactly how to go about doing this. Here is my flash action script so far:

you could see the slide show at [http://jasonkb.com/book-6.html](http://jasonkb.com/book-6.html) and click on portrait flash

Thanks,  
Jason Attach Code   
var x:XML = new XML();  
x.ignoreWhite = true;

var urls:Array = new Array();  
var captions:Array = new Array();  
var whoIsOn:Number;

x.onLoad = function(success) {  
var photos:Array = this.firstChild.childNodes;  
for(i=0;i\<photos.length;i++) {  
urls.push(photos\*.attributes.url);  
captions.push(photos\*.attributes.caption);  
}  
holder.loadMovie(urls[0]);  
caption.text = captions[0];  
whoIsOn = 0;  
}

x.load(“portrait.xml”);

previous.onRelease = function() {  
if(whoIsOn \> 0) {  
whoIsOn–;  
holder.loadMovie(urls[whoIsOn]);  
caption.text = captions[whoIsOn];  
}  
}

next.onRelease = function() {  
if(whoIsOn \< urls.length-1) {  
whoIsOn++;  
holder.loadMovie(urls[whoIsOn]);  
caption.text = captions[whoIsOn];  
}  
}
