getNextHighestDepth Gotcha

Ok, this one pisses me off hardcore. It technically works correctly on paper, but so did Marxism… or so the saying goes… whatever.

I’ve been using getNextHighestDepth for movie clips that are expendable. Timers, counters, one time processes, etc. However, movie clips created in negative depths are protected, meaning removeMovieClip will not work on them. The same goes for movie clips created at or above 1048576. Unfortunately, getNextHighestDepth will return that depth. I haven’t pinned down at what situation those depths are returned. With nothing, it’ll return 0. With a clip at 1000, it’ll return 1001. I guess at some point it just jumps to that value.

At any rate, tracking down some bugs, and this is the 2nd time I was burned by this gotcha. I don’t give a flying fizz-nuck-chuck what ECMA says, this is bs functionality. In my understanding, this command was to help me not worry about depth management. Now, however, I’m back to where I started: worrying about depth management.

Consider yourself warned.