I usually do this is with event groups. Say, I have "Controls Game" group (active) and "Controls Dialog" group (deactivated). When I need to display a dialog, I deactivate "Controls Game" group and activate "Controls Dialog".
There are other methods of course. For example, if you have lots of different controls on different layers, you can add them all into a family AllButtons, and create instance variable FunctionName. When AllButtons is touched, pick the instance which is on the highest visible layer and has the highest z-index. Then call the function from FunctionName variable.