Hello,
I’ve done the horizontal image panning tutorial on here and I was wondering what I need to change to make it vertical. Someone on here posted some code but it is in AS3 and I need it in AS2. Here is the code from the tutorial:
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));
}
};
}
I tried changing all the x’s to y’s but that allowed the image to go up and not back down. An help is MUCH appreciated! Thanks!!
Lindsae