Scrolling with mouse

hi, i have this code:

onClipEvent (enterFrame) {
if (this._x<=40 and this._x>=-800) {
_root.yChange = Math.round(_root._ymouse-this._y);
// Calculates the distance between the movie clip and the mouse
_root.xChange = Math.round(_root._xmouse-365);
// Calculates the distance between the movie clip and the mouse
_root.yMove = Math.round(_root.yChange/20);
// Determines the amount the movie clip should move toward the mouse, grows larger the further the mouse gets from the MC
_root.xMove = Math.round(_root.xChange/20);
// See above
this._x -= _root.xMove;
}
if (this._x>=40) {
this._x = 30;
}
if (this._x<=-800) {
this._x = -780;
}
}

at the moment, the movie clip moves so it reveals more in that direction and when it gets to a certain point it stops and moves the movieclip back inside the boundaries.
the problem is that as it comes to the ends/boundaries it flickers (once it is placed back inside the boundary it starts scrolling again and then keeps jumping back again)

how can i stop this?
is there a better way to script this?

thanks