Quick and Easy Depth Tricks

I was rooting around in the Flash MX 2004′ sock drawer and stumbled across a rather nifty AS file (DepthControl.as) buried in the installation directory; a little further exploratory work and i was pleasantly surprised to find some very simple methods for depth shuffling (kinda cool if you’re into game or windowed application development).

Here’s the list of publically available functions for the class:


bringForward(target:MovieClip)
sendBackward(target:MovieClip)
bringToFront(target:MovieClip)
sendToBack(target:MovieClip):Void

And having created a simple movie clip with a linkage identifier of depthTest, I added the following code to the first frame of the timeline allowing simple press-release functionality to the duplicated MCs on the stage


for (i=0; i

Now when I need to include any depth manipulation in my applications, I can simply include the class and call the functions through the prototype chain!

Login or Create Account to Comment
Login Create Account