This content has been marked as final. Show 3 replies
oops, don't use this.getNextHighestDepth(). use this._parent.getNextHighestDepth(), if all your objects have the same _parent movieclip.
Thanks for writing back. I tried your advice and it still does the same thing. All of my objects are separate movie clips but they are all on the same layer on the root level. I tried to put each object on separate layers but it still did the same. It seems that I read before that it depends on the order that you import the pictures as to what depth the pictures will be. Has anyone ever heard this? I have no other code in my project. The code that is posted above is copied 25 times and the names of the movie clips are changed.
getNextHighestDepth() doesn't work unless you are attaching a movieClip. The best way i know how to do this is to set up a variable on your main timeline such as:
var currentDepth:Number = 200;
Then in your code when they drop the item, place this code:
this will make whatever item you drop be on top at all times. Now if you want items to go beneath others or on top of others in a certain way no matter how they drop it, I would suggest defining each items depth.
(if item A's instance name is "itemA" and so on)
var item_A_Var:Number = 5;
itemB.swapDepths(item_A_Var - 1);
this will make Item B go under Item A.