Depth pseudo 3d

Based on the Y position of an object I’m trying to set the objects depth… to give a feeling of objects being in a 3d space…

I’ve been trying various things for a day or 2 now but still can’t seem to crack this. It should be simple…

Can anyone help?

I’ve attached an FLA with the axample I’m trying to do.

– here’s the method I’m using, it’s triggered from an OnRelease command, inside each MovieClip.

this.depth = Math.round(this._y);

In theory the position of the object should affect it’s Z order on screen…

…and here’s the demo.

try something like this on the timeline of the mc
this.onEnterFrame = function() {
dep = Math.round(this._y);