Scrolling bar with images


I’m having trouble with a scrolling image bar. Below is the code

onClipEvent (enterFrame) {
direction = ((-247-_root._xmouse)/25);

if ( ((this._x>=403) && (direction > 0)) || ((this._x<=-873)&&(direction<0)) ) {

direction = 0;
this._x = this._x+direction;

I have problems with line 2 of the code, whereby:
direction=((-247-_root._xmouse)/25); meaning that -247 does not work, wherby if I placed a positive number, say 2, it will work. Unfortunately, it is a series of images , like a photo gallery, so it is very long, and the centre position of the clip is a negative position, at -247. Is there a way to rectify this problem as I’m not too good with programming and got this script off from somewhere.