XML Image Gallery - Controlling Alpha Effect for Dynamic Images

Hello All,

Below is the code for dynamic image gallery from XML.

We have an alpha effect to the image animation when the image is loading. The affect is working fine (fade in).

But, when the next image is loading, we want fade out alpha affect to the current image before the next image loads.

Any idea how to achieve this task? Below is the present code.

Regards

Krishhhhhhhhhh

delay = 6000;
//-----------------------

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
raname = [];
description = [];
link = [];
total = xmlNode.childNodes.length;

//trace(tname.text);
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
raname*= xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
link* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
//trace(link*);
}
firstImage();
} else {
content = “file not loaded!”;
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
//xmlData.load(_global.server+“images.php”);
xmlData.load(“images.xml”);
//xmlData.load(“images.php”);
/////////////////////////////////////
//play_btn._visible = 0;
pause_btn.onRelease = function() {
clearInterval(myInterval);
// pause_btn._visible = 0;
play_btn._visible = 100;
};
play_btn.onRelease = function() {
myInterval = setInterval(pause_slideshow, delay);
pause_btn._visible = 100;
//play_btn._visible = 0;
};
/////////////////////////////////////
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 += 3;
}
**

}
};
//////////////////////////////////
function nextImage() {
pause_btn._visible = 100;
//play_btn._visible = 0;
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
rname.text = raname[p];
//trace(rname.text);

nlink=link[p];
slideshow();
//trace (picture._alpha)
}
}
}
function prevImage() {
if (p>0) {
p–;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
rname.text = raname[p];
//trace(rname.text);
desc_txt.text = description[p];
nlink=link[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
rname.text = raname[0];
//trace(rname.text);
desc_txt.text = description[0];
nlink=link[0];
slideshow();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
}
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
// firstImage();
} else if (p == total) {
gotoAndPlay(“credits”, 1);
} else {
nextImage();
}
}