Google Answers Logo
View Question
 
Q: Preloading XML-based Flash Slideshow ( No Answer,   1 Comment )
Question  
Subject: Preloading XML-based Flash Slideshow
Category: Computers
Asked by: wayniep00p-ga
List Price: $20.00
Posted: 12 Aug 2006 01:29 PDT
Expires: 25 Aug 2006 15:39 PDT
Question ID: 755233
Hello,

I have this XML based slide show for Flash that works fairly well
(based on the XML slideshow tutorial on the site). The slide show
currently preloads the images between the slides. It works pretty well
on a broadband connection since the load time doesn't seem to get in
the way of viewing the pictures. However, it gets pretty annoying to
see the loading screen between each image. I was wondering can I tell
flash to preload all the images on the first slide before starting the
slide show? An example of the code in action is at
http://andygoldman.com/busanutenterp...slideshow.html .

Here is the actionscript that currently drives the slide show:

("picture" is the name of the movie clip that the images load into)

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
name = [];
dimensions = [];
addinfo = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
name[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
dimensions[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
addinfo[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
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();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 5;
}
}
};

function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
name_txt.text = name[p];
dimensions_txt.text = dimensions[p];
addinfo_txt.text = addinfo[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
name_txt.text = name[p];
dimensions_txt.text = dimensions[p];
addinfo_txt.text = addinfo[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
name_txt.text = name[0];
dimensions_txt.text = dimensions[0];
addinfo_txt.text = addinfo[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" of "+total;
}

stop();

Clarification of Question by wayniep00p-ga on 14 Aug 2006 12:42 PDT
I am hoping to find a simple set of code that will tell the Flash to
load ALL the pictures referenced in the XML file just the same way it
loads between the pictures. So the preload animation will play only
once before the slideshow begins. I hope this helps.

Clarification of Question by wayniep00p-ga on 14 Aug 2006 12:43 PDT
link update if the initial posted link does not work: 

http://pellam.ucr.edu/~wfan/busanutenterprises/spaceprogram/slideshow.html
Answer  
There is no answer at this time.

Comments  
Subject: Re: Preloading XML-based Flash Slideshow
From: tresympa-ga on 13 Aug 2006 06:03 PDT
 
It's not a good solution prefer download only next picture for each
and calculate the time dowloading the next for set the inter image
delay.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy