Maybe all you have to do is put a ELSE conditional to set Zero into X axis when no button is pressed. So, when the key left up, the actor stops.
//Handle rightward movement
else if(Sup.Input.isKeyDown("D")){
new_x_speed = this.speed;
} else {
// Set here, inside the else.
new_x_speed = 0;
}