Ancient Post Alert This entry was published 14 years ago and contains technical information that may no longer be accurate. Proceed with caution.
Like lots of Flash folk, I’ve got a real love/hate relationship going with the V2 components. I shy away from them whenever I can, but sometimes, well, they’re just so darn useful. Pick up that can. Pop that top. Oh look, worms!
This time the joy came in the form of a seemingly mundane preloader I threw together using the drawing API. No need for anything in the library, just a nice, svelte little progress bar drawn in at runtime. Nothing too exotic, right? Pop it into my Flash file and blam-o! The unmistakable sound of breaking glass. My movie is playing after the preloading is done, but my progress bar is still there, stuck at 100%. “What the–? Oh brother, here we go again…”
A little Googling turns up this gem. Turns out the V2 button component drags
mx.managers.DepthManager along for the ride, which nabs the highest and lowest available depths from the Flash player and then proceeds to sit on them for future use. No big deal, but if you’re a good scout and use the
MovieClip.getNextHighestDepth() method guess whaaaaaaat… your next highest depth (1,048,576 to be precise) will be beyond the reach of
MovieClip.removeMovieClip(). Never mind all those other open slots. All together now… “D’OH!”
The solution? If you use
getNextHighestDepth() and the V2 components together in the same movie be prepared to use
swapDepths() to drag that clip back down to Earth where you can do something useful with it.
So now the real question is, think anybody’s done anything about this in Flash 8?