# MovieClip.prototype.isDepthTaken

**URL:** https://forum.kirupa.com/t/movieclip-prototype-isdepthtaken/143878
**Category:** Uncategorized
**Created:** [April 9, 2005, 5:11pm UTC](https://forum.kirupa.com/t/movieclip-prototype-isdepthtaken/143878 "2005-04-09T17:11:29Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Voetsjoeba](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@Voetsjoeba](https://forum.kirupa.com/u/Voetsjoeba)
#### Post date: [April 9, 2005, 5:11pm UTC](https://forum.kirupa.com/t/movieclip-prototype-isdepthtaken/143878/1 "2005-04-09T17:11:29Z")

</div>

Here’s a little prototype to check whether a depth in a movieclip is occupied or not.

```auto

MovieClip.prototype.isDepthTaken = function(d:Number){
	for(var all in this){
		if(this[all] instanceof MovieClip || this[all] instanceof Button || this[all] instanceof TextField){
			if(this[all].getDepth() == d) return true;
		}
	}
	return false;
}
this.createEmptyMovieClip("foo", 99);
trace(this.isDepthTaken(99)); // true

```
