# Any ideas how to temporarily turn off a Z-sorting button?

**URL:** <https://forum.kirupa.com/t/any-ideas-how-to-temporarily-turn-off-a-z-sorting-button/175821>\
**Category:** flash\
**Created:** [January 18, 2006, 2:37am UTC](https://forum.kirupa.com/t/any-ideas-how-to-temporarily-turn-off-a-z-sorting-button/175821 "2006-01-18T02:37:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![heavyD](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@heavyD](https://forum.kirupa.com/u/heavyD)\
**Post date:** [January 18, 2006, 2:37am UTC](https://forum.kirupa.com/t/any-ideas-how-to-temporarily-turn-off-a-z-sorting-button/175821/1 "2006-01-18T02:37:50Z")

</div>

My Z-sorting works great, but it would be nice if the button became inactive if the topDepth = 1. If another button is clicked it would become active again. This would prevent the menu\_1\_mc from playing again if clicked repeatedly.

Heres the code. Any clues? thx. h

// set a variable to start initial depth  
topDepth = 1;

// handle onRelease event  
b1.onRelease = b1.onReleaseOutside = function() {  
\_root.menu\_1\_mc.swapDepths(\_root.topDepth);  
++\_root.topDepth;  
\_root.menu\_1\_mc.gotoAndPlay(1);

};

–  
I tried something like this but couldnt get it to work…  
if (\_root.topDepth == 1) {  
\_root.menu\_1\_mc = new \_root.topDepth();  
}
