I am building a Tic Tac Toe game where I duplicate a movieClip “oh” and it is placed on a Tic Tac Toe board by snapping it to a position.
This works, however when it duplicates movieClip “oh”, it puts it on top of everything else. I need to have “oh” below another movieClip on the stage, “my_mc”.
None of the last four lines of code do not work. I need “oh” to go below “my_mc”.
I’ve tried placing the swapDepths code in an onEnterFrame function, on and inside my_mc, and elsewhere in the main timeline, but nothing works to bring it to the top.
If you call getDepth on the various elements that you’re trying to move around, do the values make sense?
Are all of the MovieClips direct children of _root?
That seems like it could be dangerous, since you’re eating up 1000 depths, it seems, per frame. Rather than just one or two when someone makes a tic-tac-toe move.
It also looks like you haven’t tried: _root["oh" + tmp].swapDepths(my_mc).
Really? From the rest of your post’s description, it sounds like you want "oh" + tmp to go below my_mc, because it’s the one that has been newly duplicated. Referencing oh by itself will target the old copy, not the new copy.