have been running into the same problem multiple times and I know there is an easier way to do this.. any ideas out there?

here would be an example of some code:

PHP Code:
btn1.onPress = function(){
    do 
the same thing;
    }
btn2.onPress = function(){
    do 
the same thing;
    }
btn3.onPress = function(){
    do 
the same thing;
    }
btn4.onPress = function(){
    do 
the same thing;
    }