you could use getnexthighestdepth but it might not always be suitable for what your asking. hmmm..from what your saying you want a button to swap around layers..and the only reason you'd want to do that is to make things either appear or dissapear im guessing.. why not add this instead:
Code:
buttonname.onRelease = function() {
objectname._visible = false;
and
Code:
buttonname.onRelease = function() {
objectname._visible = true;
you get the same effect (paste into main timeline)
by using the _visible code just add multiple lines to turn off everything in the same layer.
for example you have three objects in one layer and one object in another. you would have:
button1.onRelease = function () {
objectone._visible = false;
objecttwo._visible = false;
objectthree._visible = false;
}
this would just leave the fourth object on screen.
reverse this if you want the opposite effect to turn them back on.