if(this._x <0){
this._x=0;
}
if(this._x> 720){
this._x =720;
}
if(this._y <50){
this._y = 50;
}
if(this._y> 500){
this._y = 500;
}
}


That's one approach. You may have to tweak some numbers, but that's the general concept.