Forum Moderators: open
Also, it needs to return as smooth as it pans. I am trying to avoid having it "snap" back immediately. I'm just getting into actionscript, so I am pretty stuck. But I'm sure an experienced actionscripter can hit this out of the park.
The code:
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 == 0) {
[code]
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/100));
}
};
}