Interactive Image Pan positioning

Hi. I’m quite new in ActionScript (but I know the basics). Well anyway, I have a small problem. I’m doing this fake panorama to my site and I’ve used this Interactive Image Panning code I found here at kirupa.com. Now I have added some buttons into it and by pressing those I would like the image to move to a specific position (with ease if it’s possible) and stop. And by pressing another button the panning starts again. Is it possible to add to this code?
(I have made some little modifications to the code. There is a mask area where the panning works and if your mouse is outside the area the panning doesn’t work)

I would really appreciate for your help!!

Thanks.
Mikko

I’m using this same technique on a website I’m working on except the cursor moves up and down as well as left and right. This works fine however. It’s when I want to start the panning again after stopping it do things go south. Here’s my actionscript:

stop();

Stage.scaleMode="noScale";
Stage.align="TL";

onMouseMove = function ():Void {
    constrainedMove(img, 5, 0, 0, _xmouse, _ymouse);
};

img.SS_mc.onRelease = function():Void  {
    delete onMouseMove;
    var xpos = -400;
    var ypos = -100;
    definedMove(img, 5, xpos, ypos);
    this.gotoAndPlay(2);
    delete this.onRelease;
};

img.SS_mc.exit.onRelease = function ():Void {
    gotoAndStop(1);
    onMouseMove = function ():Void {
    constrainedMove(img, 5, 0, 0, _xmouse, _ymouse);
    };
};
    
    

function constrainedMove(target:MovieClip, speed:Number, dir:Number, dir2:Number):Void {
    var mousePercent:Number = _xmouse/Stage.width;
    var mousePercent2:Number = _ymouse/Stage.height;
    var mSpeed:Number;
    var mSpeed2:Number;
    if (dir == 1) {
        mSpeed = 1-mousePercent;
    } else {
        mSpeed = mousePercent;
    }
/////////////////////////////
    if (dir2 == 1) {
        mSpeed2 = 1-mousePercent2;
    } else {
        mSpeed2 = mousePercent2;
    }
////////////////////////
    target.destX = Math.round(-((target._width-Stage.width)*mSpeed));
    target.destY = Math.round(-((target._height-Stage.height)*mSpeed2));
    target.onEnterFrame = function() {
        if (target._x == target.destX) {
            delete target.onEnterFrame;
    } else {
            target._x += Math.ceil((target.destX-target._x)*(speed/75));
    }
        if (target._y == target.destY) {
            delete target.onEnterFrame;
    } else {
            target._y += Math.ceil((target.destY-target._y)*(speed/75));
        }
    };
}
function definedMove(target:MovieClip, speed:Number, destination:Number, destination2:Number):Void {
    target.onEnterFrame = function() {
        if (target._x == destination) {
            delete target.onEnterFrame;
        } else if ((destination-target._x)>0) {
            target._x += Math.ceil((destination-target._x)*(speed/100));
        } else {
            target._x += Math.floor((destination-target._x)*(speed/100));
        };
        if (target._y == destination2) {
            delete target.onEnterFrame;
        } else if ((destination2-target._y)>0) {
            target._y += Math.ceil((destination2-target._y)*(speed/100));
        } else {
            target._y += Math.floor((destination2-target._y)*(speed/100));
        };
    };
};

The part that doesn’t work is this:

 img.SS_mc.exit.onRelease = function ():Void {
    gotoAndStop(1);
    onMouseMove = function ():Void {
    constrainedMove(img, 5, 0, 0, _xmouse, _ymouse);
    };
};

The movieclip is nested inside of the SS_mc movieclip. When I put this script at the root level it won’t work at all but when I put it on the same level as the movieclip only the gotoAndStop command works. Either way the onMouseMove function is not coming back to life. Any help on this would be great. Thanks so much!