PDA

View Full Version : XML slideshow using full URL


jasonc310771
11-12-2008, 02:33 PM
been taking a look at some action scripts but still none the wiser.

wanting to find a script that can read a XML file and get the files complete URL and the description for the image.

xml file called... images.xml

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>http://www.site.com/images/img1.jpg</image>
<caption>first image desc</caption>
</pic>
<pic>
<image>http://www.site.com/image/somethingelse.jpg</image>
<caption>second image desc</caption>
</pic>
</images>




then the flash file would read this and show the images in this order one by one with a gap of say 3 second or using a variable to set the gap.

i have a script that was given to me but this one i can not access the fla file for some reason, so decided to create it from scratch.

just the image and a description is need no back or forward buttons.

can someone please point me in the direct of a script that can do this.

thanks

gnomeontherun
11-12-2008, 03:46 PM
There are other tutorials in the sticky at the top of the forum, but here is an example tutorial.

http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm

jasonc310771
11-13-2008, 01:46 PM
yep tried that one a while ago and tried to redo the flash file and when done i tested it and it did not work correctly, it seem to missed out every other image.

so i mixed up the image XML file and still it missed the same every other image not the same images that would not show before

i tried to remove the previous and next button and just got it all messed up.

all i was trying to do is have just an image and a text bar below it with a description and then the photo number and how many are left, but no forward or back button and have it show them one after another in a slide show.

does anyone know how to change the previous posts fla file or know of a better one that just does this and also lastly i would really like to have it fill screen, or be allowed to change the size of the view in my HTML code i am embedding it in.

gnomeontherun
11-13-2008, 03:33 PM
Well there must be a function to advance the slideshow, based on time instead of based on forward/backward buttons.

We just need to delete some code, remove the buttons, and add a timer function to advance the slideshow.

Remove this code from that tutorial

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();

};

And replace it with this code (the 1000 is the duration, which is in milliseconds, so 1000 is 1 second)

setInterval( nextImage, 5000 );

If you want it to be larger, you can either change the size of the stage in the FLA, or there is some code to help you with that. Make a button for fullscreen and use this code.

buttonName.onPress=function() {
if (Stage["displayState"] == "normal") {

Stage["displayState"] = "fullScreen";
} else {

Stage["displayState"] = "normal";
}
}

Also if you want your slideshow to automatically replay, change the nextImage function to this

function nextImage() {

if (p<(total-1)) {

p++;
}
else {
p = 0;
}
if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();

}

You can also delete the prevImage function, as it no longer is used.