Thursday, July 23, 2009

getNextHighestDepth in as3

In as2 you were able to put a movieclip on top of all the other containing movieclips. I'm working with as3 now and was searching for this same option.

You can do it with one line of code:

as2:

//container is the parent of the movieclip
movieclip.swapDepths(container.getNextHighestDepth());

as3:

//container is the parent of the movieclip
container.setChildIndex(movieclip, (container.numChildren - 1));