My other issue - falling behind

Quick recap if you haven’t seen the other thread:

Have doors that open when clicked and close when clicked. When you click one it uses getNextHighestDepth and swapDepths to come to the forefront so the door doesn’t open “under” the neighboring door. I’ve also set it up so that you can open each set of doors (left and right) together but if you click any other door the originally open door (or doors if you’ve opened both) close and then the new ones open.

Some odd things happen though. If you open door 3 (a left door) for example, then door four (the right counterpart) SOMETIMES door 3 drops behind the artwork for door 2.

Only sometimes.

I’ve gone so far as to retrieve the depth of the clicked door (after getting the next highest depth), storing that as a number variable, then adding (++) to that variable and swapping depths with this new incremented variable thinking that might help (so the second door is not just swapping with the first clicked door, sending it down to where the second door was in case it was lower than others).

See the screen grab for an idea of the proximity and how the doors will open under neighboring doors.

Convoluted code which doesn’t appear to be working is:

    nextDepth = this.getNextHighestDepth();    incrementalDepth = nextDepth++;
    this.swapDepths(incrementalDepth);
    trace(nextDepth);
    holdDepth = this.getDepth();
    this.play();
    this.swapDepths(holdDepth);



Hold depth is my attempt to “lock” the mc at it’s new depth until that depth increments.

Oddly, my traces are all “1”???

I’m pulling my hair out over this - which is funny 'cuz I haven’t got any hair…

Something I DID manage to accomplish (in case it helps you explain to me what I’m doing wrong)…when you open the cupboards there are items inside that you can drag out and drop into the grocery bags in the front there. They are on a layer under the cupboard doors but when you click to start the drag they jump to the next highest level so that you don’t drag them under the other doors. If you “miss” it snaps back where you found it AND drops back to it’s original depth (so it falls behind the doors when they close).

I can’t thank you enough for your time and thoughts on this. It’s driving me nuts (as you can tell from the desperate ActionSctript and the novel-length thread).