Slideshow is really kinda rare at the internet , I tried to look at some ready Slideshow that need just some modification and here we are ready , but it seems that I can't find what I want, that why I want to write this tutorial to help some people like me that are interested in a slide show .

This slide show is made with Flash 8 and ActionScript 2, and Will use the XML File .

The XML File "filelist.xml" would look like something like this :


<?xml version="1.0" encoding="utf-8"?>
<imagelist> <pix>img1.jpg</pix>
<pix>img2.jpg</pix>
<pix>img3.jpg</pix>
</imagelist>

At the First Frame Paste This Code



var counter:Number = 0;


var XMLValue:XML = new XML();
XMLValue.ignoreWhite = true;
XMLValue.load("filelist.xml");
XMLValue.onLoad = function(success) {

if (success) {
ChangeClip(XMLValue);
intervalId = setInterval(ChangeClip, 10000, XMLValue );
}

};



function ChangeClip(XMLValue) {
element = XMLValue.firstChild;

if(element.childNodes[counter].firstChild.nodeValue==undefined){
counter = 0;
}




this.createEmptyMovieClip("ourMovieClip",this.getNextHighestDepth());
ourMovieClip._alpha = 0;


loadMovie(element.childNodes[counter].firstChild.nodeValue, "ourMovieClip");

easeType = mx.transitions.easing.Regular.easeOut;
var begin = 20;
var end = 100;
var time = .5;
var mc = ourMovieClip;

ballTween = new mx.transitions.Tween(mc, "_alpha", easeType, begin, end, time, true);

counter++;


}

Now let's Analyse the code a little bit for more understanding to this slideshow.

var XMLValue:XML = new XML();
XMLValue.ignoreWhite = true;
XMLValue.load("filelist.xml");
XMLValue.onLoad = function(success) {

if (success) {
ChangeClip(XMLValue);
intervalId = setInterval(ChangeClip, 10000, XMLValue );
}

};
This Snippet of Code will load the xml file , and will launch the function ChangeClip() with an interval of 10 seconds , which means that the function will be repeated each 10 seconds and will change the picture.

function ChangeClip(XMLValue) {
element = XMLValue.firstChild;

if(element.childNodes[counter].firstChild.nodeValue==undefined){
counter = 0;
}




this.createEmptyMovieClip("ourMovieClip",this.getNextHighestDepth());
ourMovieClip._alpha = 0;


loadMovie(element.childNodes[counter].firstChild.nodeValue, "ourMovieClip");

easeType = mx.transitions.easing.Regular.easeOut;
var begin = 20;
var end = 100;
var time = .5;
var mc = ourMovieClip;

ballTween = new mx.transitions.Tween(mc, "_alpha", easeType, begin, end, time, true);

counter++;


}

This Snippet of code is a function that will load the image or the Movie Clip in the Stage and will increase the value of the counter

the Transition that was used here is a type of transition that wasn't documented in the flash class documentation , there is a lot different method for doing this kind of transition , so you can have a different type of transition.

Download the FLA Image SlideShow

Posted in Libellés : , Publié par y. elhafyani à l'adresse 10:12 AM  

0 commentaires:

 
Copyright 2005-2008 Flash RIA .