Keyboard keys

i want this code to move my map i.e map_mc when the keyboard keys are pressed. when i add it to the map_mc ,i see no effect what do u think im messing with.


on (keyPress "<Left>") {
     currentX = this._x;
     this._x = currentX - 2;
    
} 
on (keyPress "<Right>") {
     currentX = this._x;
     this._x = currentX + 2;
    
} 
on (keyPress "<Up>") {
     currentY = this._y;
     this._y = currentY - 2;
    
} 
on (keyPress "<Down>") {
     currentY = this._y;
     this._y = currentY + 2;
    
}