Posts Tagged ‘slideshow’

UWSP - XML Slide show

Friday, April 10th, 2009

This is a slide show that I made for a client that wanted a image gallery on their website. I used Flash and Actionscript 3 to make their photo gallery so their web users could see the images easier. They really liked it because it gave their users a more interactive experience with their photo galleries. I made this from scratch while learning AS3. This imports XML to find the image path and the caption for the picture.

menu_xml = XML(event.currentTarget.data);
var picList:XMLList = menu_xml.pic;
for(var i:Number = 0; i < picList.length(); i++) {
imageArray.push(picList.image[i]);
captionArray.push(picList.caption[i]);
}
caption.text = captionArray[index];
imageLoader.load(new URLRequest(imageArray[index]));

There is also a random function that uses the Math.random native function in flash.

index = Math.round(Math.random() * imageArray.length);
//if to catch the errors in the random function
if(index == playedArray[playedArray.length - 1] || index == imageArray.length) {
getImageIndex();
} else {
playedArray.push(index);
curNum += 1;
imageLoader.load(new URLRequest(imageArray[index]));
caption.text = captionArray[index];
}

Take a look