Help with interactive image panning

Hi I’ve been following the tutorial on the site for interactive image panning, but i would like to be able to pan both on the x and y axis, i’ve been trying various things but with no luck, can anyone point out how i go about adjusting the code to do X & Y?

do i need to create a whole new function fo the Y or can i incorporate it into the current code.

help is great;y appreciated

function constrainedMove(target:MovieClip, speed:Number, dir:Number) {
    var mousePercent:Number = _xmouse/Stage.width;
    var mSpeed:Number;
    if (dir == 0) {
        mSpeed = 1-mousePercent;
    } else {
        mSpeed = mousePercent;
    target.destX = Math.round(-((target._width-Stage.width)*mSpeed));
    target.onEnterFrame = function() {
        if (target._x == target.destX) {
            delete target.onEnterFrame;
        } else {
            target._x += Math.ceil((target.destX-target._x)*(speed/18));

thanks for your help