# Swapdepth()

**URL:** <https://forum.kirupa.com/t/swapdepth/135104>\
**Category:** Uncategorized\
**Created:** [January 24, 2005, 8:50pm UTC](https://forum.kirupa.com/t/swapdepth/135104 "2005-01-24T20:50:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yossarian](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@yossarian](https://forum.kirupa.com/u/yossarian)\
**Post date:** [January 24, 2005, 8:50pm UTC](https://forum.kirupa.com/t/swapdepth/135104/1 "2005-01-24T20:50:44Z")

</div>

I’ve been trying to attach a swapdepth() to this script so that the txt is arranged ontop of the MC but with no luck…Does anyone know what I need to do?

Here’s the code:

```auto

// ************************
var str:String = "This is a String";
var strSplit:Array = str.split("");
for (var i = 0; i<strSplit.length; i++) {
	if (strSplit* != ' ') {
		this.createEmptyMovieClip("text"+i, this.getNextHighestDepth());
		//this.createEmptyMovieClip("textAlpha"+i, this.getNextHighestDepth());
		_root["text"+i].createTextField("txt", 1, 5, 5, 20, 20);
		_root["text"+i].txt.text = strSplit*;
		_root["text"+i]._x = _root["text"+i]._x+15*i;
		_root["text"+i].txt.type = "static";
		_root["text"+i].onPress = function() {
			this.startDrag();
		};
		_root["text"+i].onRelease = function() {
			this.stopDrag();
			theDrop=eval(this._droptarget);
			trace(theDrop.myLetter);
			if(theDrop.myLetter==this.txt.text){
				trace('match!');
			}
		};
		this.attachMovie('drop','drop'+i,this.getNextHighestDepth());
		_root["drop"+i]._x=100+(i*25);
		_root["drop"+i]._y=300;
		_root["drop"+i].myLetter=strSplit*;
		
		
	}
}
// ************************

```

I’d be very grateful for a good nudge in the right direction! :esmirk:

Yossi
