sometime you need to know which is highest dept used in movie, couse if you dynamically create some objects they can be over some predefined objects.
also it is neccessary while you dynamically create new object to give it new depth, if you give wrong depth it will erase existing object.
so, here it is.
CODE
onFrame(y) {
x=-16385; // lowest depth
for (z in this) { // lets find highest depth
x=Math.max(this[z].getDepth(),x); // find depth of every object on actual level
}
// and if you want some object on top of the scene, do this
yourObject.swapDepths(x+1); // swap to higest depth +1
}
note: only for swf 6