MovieClip.prototype.isDepthTaken

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


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