PDA

View Full Version : [FMX2004] help with XML slideshow



Candyman3d
February 23rd, 2005, 05:53 PM
Hi! I'm very newbie in Flash so I'm asking to have patience:)
I'm trying to make my own slideshow WITHOUT buttons and WITHOUT preloaders. The idea is to preload all images from outside then to convert them to MovieClips and then using transitions between them run the slideshow.
My question is: How to convert preloaded images to clips in order to avoid reloading images each time in every frame and make the slideshow without blinking? GIVE ME SOME ADVICE, PLEASE!!!
HERE (http://cicplata.org/fla-project.zip) you can download whole project without images (you can use yours instead to see how it work).

This is slightly modifyed code of THIS (http://www.kirupa.com/developer/mx2004/xml_slideshow.htm) tutorial that I'm using in my project:

this.onLoad = function() {
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
}
backimage.loadMovie(image[0], 1);
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("config.xml");
};

p = 0;
this.onEnterFrame = function() {
picture._alpha -= 7;
if (picture._alpha<10) {
nextImage();
}
};
function nextImage() {
if (p<(total-1)) {
p++;
picture._alpha = 100;
//trace(image[p]);
picture.loadMovie(image[p], 1);
//loading background
if ((p+1)<total) {
backimage.loadMovie(image[p+1], 1);
} else {
backimage.loadMovie(image[p], 1);
}
} else {
p = 0;
}
}
function firstImage() {
picture.loadMovie(image[0], 1);
backimage.loadMovie(image[1], 1);
}

Any help would be greatly appreciated. Thank you!