# Preload all jpgs with XML gallery

**URL:** <https://forum.kirupa.com/t/preload-all-jpgs-with-xml-gallery/256585>\
**Category:** flash\
**Created:** [April 4, 2008, 10:08am UTC](https://forum.kirupa.com/t/preload-all-jpgs-with-xml-gallery/256585 "2008-04-04T10:08:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thirteendot](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@thirteendot](https://forum.kirupa.com/u/thirteendot)\
**Post date:** [April 4, 2008, 10:08am UTC](https://forum.kirupa.com/t/preload-all-jpgs-with-xml-gallery/256585/1 "2008-04-04T10:08:56Z")

</div>

Hi,  
I have a an xml image gallery with at least 5 jpgs loading into the flash movie. These a called via the XML file.  
I have the images loaded in ok, but I would like to load the first image in and pan down the Y axis, while the second image loading in the background and then fade and pan in up the Y axis, they will alternate with every consecutive image. And then loop through from the begining again.

I needs either to prelaod all the images into the flash movie and slide the images with a smooth transition or load them individually while one has loaded in the background.  
[COLOR=darkred]\*\*XML file loads in ok, images are pulling through but the preloader bit is not loading correctly.:hr: \*\*[/COLOR]  
Code below:

[AS]stop();  
//Call XML script//  
function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
image = [];  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
image\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
}  
intervalId = setInterval(this, “executeCallback”, duration);  
} else {  
content = “file not loaded!”;  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“images.xml”);  
/////////////////////////////////////  
//Call set Interval to fade image in 1 by 1//  
var intervalId:Number;  
var duration:Number = 1500;  
function executeCallback():Void {  
nextImage();  
if (p\>total-2) {  
p = 0;  
} else {  
p++;  
}  
}  
intervalId = setInterval(this, “executeCallback”, duration);

///////////////////////////////////////////////  
init();  
function init() {  
p = 0;  
}  
//Preloader//  
this.onEnterFrame = function() {  
filesize = \_root.picture.getBytesTotal();  
loaded = \_root.picture.getBytesLoaded();  
preloader.\_visible = true;  
if (loaded != filesize) {  
preloader.preload\_bar.\_xscale = 100\*loaded/filesize;  
picture.\_visible = false;  
}  
else if (loaded == filesize) {  
preloader.\_visible = false;  
picture.\_visible = true;  
if (picture.\_alpha\<100) {  
picture.\_alpha += 10;  
}  
}  
};  
//load and Jump to next image//  
function nextImage() {  
if (loaded == filesize) {  
picture.\_alpha = 0;  
picture.loadMovie(image[p], 1);  
}  
}[/AS]

Please can anyone help out? Or suggestions?

Im:sigh:
