Loop/onpress

See the code, I cant get it to work. when i press a button i get “1” in temp. how do i make so it dont get only “1”?

for (k;k>=1;k--) {
    m_mall[k].onPress = function() {
        
        temp = k;
        trace(temp)
        displayen.text = displayen.text + knapp[temp].text
        displayen.setTextFormat(myformat2)
    }
}