The problem was the value of the mapYOffset variable wich now is the Y coordinate of the last button visible per default in the map of the game.
It works like a charm now. Thank you very much, Krhis!
It works like a charm now. Thank you very much, Krhis!