# Image pan tutorial, possible to add autopan?

**URL:** <https://forum.kirupa.com/t/image-pan-tutorial-possible-to-add-autopan/231940>\
**Category:** flash\
**Created:** [July 9, 2007, 7:54pm UTC](https://forum.kirupa.com/t/image-pan-tutorial-possible-to-add-autopan/231940 "2007-07-09T19:54:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![somnamblst](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@somnamblst](https://forum.kirupa.com/u/somnamblst)\
**Post date:** [July 9, 2007, 7:54pm UTC](https://forum.kirupa.com/t/image-pan-tutorial-possible-to-add-autopan/231940/1 "2007-07-09T19:54:35Z")

</div>

I am hoping to figure out how to have the panorama image scrolling before the mouseMove in order to attract the viewer attention to it’s interactive qualities. Is that possible with the method below?

```auto
this.onMouseMove = function() {
    constrainedMove(bg_mc, 4, 1);
};
function constrainedMove(target:MovieClip, speed:Number, dir:Number) {
    var mousePercent:Number = _xmouse/Stage.width;
    var mSpeed:Number;
    if (dir == 1) {
        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 if (target._x>target.destX) {
            target._x -= Math.ceil((target._x-target.destX)*(speed/100));
        } else if (target._x<target.destX) {
            target._x += Math.ceil((target.destX-target._x)*(speed/100));
        }
    };
}

```
