Lee Brimelow posted on his blog about a z-sorting class for flash 10. I was surprised that z-sorting isn’t a native method in Flash Player 10. I remember seeing a demo by Justin Everett Church of a carousel in FP10, and I don’t recall him doing any z-sorting explicitly.. but I can’t remember how he did it.
Anyhow, I had an idea for doing this fairly simply, by sorting the sprites on their ‘z’ value (descending) and simply callg addChild() to re-add them with a new depth corresponding to their z-depth. The code is probably easier to understand than my explanation of it.. it only takes a few lines. This may not be as sophisticated as the z-sorting class above, but hey, it works for me.
flash 10 required
update: I changed the code to use setChildIndex() instead of addChild(), & it seems to run a bit smoother.
Here’s the Fish.