Help with function created in for loop

I have the following code that should set the onPress events for movieclips

function actionSetter() {        
        
        for(var k = 0; k< 5; k++) {
            
            trace(k); //traces correctly

            _level0["EventBtn" + k].onPress = function() {
             
                trace(k); //always traces as 5 regardless of which btn is pressed
            }
            
        }
    }

What should I do to correctly define onPress for my movieclips within the loop?

Help please