Skip to Content »

FlashApe » getNextHighestDepth for Flash Player 6

 getNextHighestDepth for Flash Player 6

  • June 10th, 2004
  • 5:35 pm

I don’t know why this never occured to me before, but as I was checking out AS2 I came across the new MovieClip methods getNextHighestDepth and getInstanceAtDepth. Since they are only available in Flash Player 7, I wrote them out for Flash Player 6:

bc[as]. MovieClip.prototype.getNextDepth = function() {
var depth = 0;
for (var prop in this) {
if (typeof this[prop] == “movieclip”) {
trace(”depth = “+this[prop].getDepth());
var newDepth = this[prop].getDepth();
if (newDepth>depth) {
depth = newDepth;
}
}
}
return depth+1;
};

bc[as]. MovieClip.prototype.getClipAtDepth = function(depth) {
for (var prop in this) {
if (typeof this[prop] == “movieclip”) {
if (this[prop].getDepth() == depth) {
return this[prop];
}
}
}
};

Want your say?

* Required fields. Your e-mail address will not be published on this site


You can use the following XHTML tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>