Scrolling view area on a larger bitmap (smoothly!)

Hello all,

I’ve written code to allow a frame to scroll around a bitmap image, sort of like a visible view area on a larger map. The area outside the frame is masked so you only see the portion of the bitmap visible within the frame and the mouse position determines the direction and amount of movement that happens. Here’s my code for the onEnterFrame action of the map_mc, which enables the scrolling…

map_mc.onEnterFrame = function() {
easing = someValue;
moveRatio = mapWidth / viewWidth;
moveDist = int(mousePos - mousePos*moveRatio) - this._x;
this._x += int(moveDist/easing);
}

(you can think of mousePos as being _root._xmouse)

Seems simple enough… But that’s sort of the problem: the movement is very jerky and I can’t seem to work out a smoother way to do it. Hopefully someone has a suggestion or two?

Thanks in advance if you can help