# Changing the photogallery script

**URL:** <https://forum.kirupa.com/t/changing-the-photogallery-script/202382>\
**Category:** flash\
**Created:** [September 30, 2006, 12:46pm UTC](https://forum.kirupa.com/t/changing-the-photogallery-script/202382 "2006-09-30T12:46:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tvirus](https://avatars.discourse-cdn.com/v4/letter/t/f07891/32.png) [@Tvirus](https://forum.kirupa.com/u/Tvirus)\
**Post date:** [September 30, 2006, 12:46pm UTC](https://forum.kirupa.com/t/changing-the-photogallery-script/202382/1 "2006-09-30T12:46:05Z")

</div>

Hi,

I need a little bit of help with my photogallery.  
What I want to do is change this photogallery script: [http://www.kirupa.com/developer/mx2004/xml\_flash\_photogallery.htm](http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm)

What I want is to load and fade in the new picture on the old picture, not to remove the picture \> show the loading bar \> fade in the new pictrue.

How do I do this?  
THis is my action script:

```auto

function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		description = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
			description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
		}
		firstImage();
	} else {
		content = "file not loaded!";
	}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("pictures.php");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
	if (Key.getCode() == Key.LEFT) {
		prevImage();
	} else if (Key.getCode() == Key.RIGHT) {
		nextImage();
	}
};
Key.addListener(listen);
npbut.prev_btn2.onRelease = function() {
	prevImage();
};
npbut.next_btn2.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<0) {
			picture._alpha += 2,5;
		}
	}
};

function chooceImage(img){
	if(img<=total-1 and img > 0){
		p	= img;
		if (loaded == filesize) {
			picture._alpha = 0;
			picture.loadMovie(image[p], 1);
			desc_txt.text = description[p];
			picture_num();
		}
	}
}

function nextImage() {
	if (p<(total-1)) {
		p++;
		if (loaded == filesize) {
			picture._alpha = 100;
			picture.loadMovie(image[p], 1);
			desc_txt.text = description[p];
			picture_num();
		}
	}
}
function prevImage() {
	if (p>0) {
		p--;
		picture._alpha = 0;
		picture.loadMovie(image[p], 1);
		desc_txt.text = description[p];
		picture_num();
	}
}
function firstImage() {
	if (loaded == filesize) {
		picture._alpha = 0;
		picture.loadMovie(image[0], 1);
		desc_txt.text = description[0];
		picture_num();
	}
}
function picture_num() {
	current_pos = p+1;
	pos_txt.text = current_pos+" / "+total;
}

```

here is my .fla:  
[http://www.paulpeelen.com/files/flash/gallery.fla](http://www.paulpeelen.com/files/flash/gallery.fla)

Hope someone can help me!

Best regards,  
Paul Peelen
