# \[Flash8\] DuplicateMovieClip and Swapdepths

**URL:** <https://forum.kirupa.com/t/flash8-duplicatemovieclip-and-swapdepths/191759>\
**Category:** flash\
**Created:** [June 22, 2006, 7:11pm UTC](https://forum.kirupa.com/t/flash8-duplicatemovieclip-and-swapdepths/191759 "2006-06-22T19:11:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![americanloti](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@americanloti](https://forum.kirupa.com/u/americanloti)\
**Post date:** [June 22, 2006, 7:11pm UTC](https://forum.kirupa.com/t/flash8-duplicatemovieclip-and-swapdepths/191759/1 "2006-06-22T19:11:19Z")

</div>

Hello everyone!

I’m new here, and like most of the people in this forum i’m looking for some help.

I’m trying to build a PhotoGallery applications. I’m using an external XML file to load the content and a DuplicateMovieClip method to create the holders for each thumbnail. Now I would like to implement an effect each time I rollover each thumbnail since they are overlapping. The effect I have in mind is a simple swaptDepths that brings the selected thumbnail on top of the others. I’m not quite sure how to reference the movieclip I want to bring on top of the others since they are all created dinamically. I tried to put a onRollOver function inside the for statement I used to create the dinamic clips, but obviously the swaptDepths method is not working. Any idea how I can accomplish this? I hope waht I wrote made sense. I’m posting part of the code I’m working with anyway.  
Any help would be really appreciated. Thank you for your time!

here it is:

```auto

myXML.onLoad = function(bSuccess:Boolean):Void {
	if (bSuccess) {
		xnCatNode = myXML.childNodes[1];
		for (var i:Number = 0; i<xnCatNode.childNodes.length; i++) {
			aThumb.push(xnCatNode.childNodes*.lastChild.firstChild.nodeValue);
			var nRandom:Number = randRange(0, 7);
			var sCard:String = "card"+i;
			var nSpacing:Number = 50;
			thumbnail_mc.card.duplicateMovieClip(sCard, i);
			thumbnail_mc[sCard]._y = i*nSpacing;
			thumbnail_mc[sCard]._rotation = aRotation[nRandom];
			thumbnail_mc[sCard].base.filters = [DropS];
			myMCL.loadClip(aThumb*, thumbnail_mc[sCard].thumb_holder);
			thumbnail_mc[sCard].onRollOver = function() {
                      //some code to swapDepths?
			};
		}
	} else {
		error_txt.text = "Unable to load Photo Library. Please try again later.";
	}
};

```
