# Slideshow with movieclip transition

**URL:** <https://forum.kirupa.com/t/slideshow-with-movieclip-transition/272974>\
**Category:** Uncategorized\
**Created:** [October 9, 2008, 7:47pm UTC](https://forum.kirupa.com/t/slideshow-with-movieclip-transition/272974 "2008-10-09T19:47:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![heartless](https://avatars.discourse-cdn.com/v4/letter/h/d07c76/32.png) [@heartless](https://forum.kirupa.com/u/heartless)\
**Post date:** [October 9, 2008, 7:47pm UTC](https://forum.kirupa.com/t/slideshow-with-movieclip-transition/272974/1 "2008-10-09T19:47:52Z")

</div>

i’m trying to modify the xml slideshow code. i’ve done some searching, but haven’t really found an answer for what i’m looking for.

instead of adjusting the alpha property for a fade out transition, i’m trying to use a movieclip to create a flashing transition between photos. i’m basically trying to achieve an effect similar to the one on the photo slideshow in the header of [this page](http://www.bleedingthrough.com/main.php). i tried to use attachMovie, but i couldn’t get that to work the way i wanted it to. i’ve got this effect working right now by just setting movieclip.play(); in the nextImage function, but is there a better way to do it? i’m suspecting that this is possibly eating up memory, so if there is a more efficient way to do this, or if i’m doing it wrong, i was wondering if anybody could point me in the right direction.

here is my code:

```auto
var delay:Number = 4500;

//flashmc.stop();

function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			image* = xmlNode.childNodes*.attributes.url;
		}
		firstImage();
	} else {
		content = "file not loaded!";
	}
}

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");

/*listen = new Object();
listen.onKeyDown = function() {
	if (Key.getCode() == Key.LEFT) {
		prevImage();
	} else if (Key.getCode() == Key.RIGHT) {
		nextImage();
	}
};*/

var p:Number = 0;
//var p:Number = Math.floor(Math.random()*total);

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 += 10;
		}
	}
};

function nextImage() {
	if (p<(total-1)) {
		p++;
		if (loaded == filesize) {
			//picture._alpha = 0;
			picture.loadMovie(image[p], 1);
			picture_num();
			slideshow();
			flashmc.play();
		}
	}
}

function prevImage() {
	if (p>0) {
		p--;
		picture._alpha = 0;
		picture.loadMovie(image[p], 1);
		picture_num();
	}
}

function firstImage() {
	if (loaded == filesize) {
		//picture._alpha = 0;
		picture.loadMovie(image[0], 1);
		picture_num();
		slideshow();
		flashmc.play();
		//attachMovie("flashmc", "picture", 1);
	}
}

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

```
