I’m trying to modify this image pan tutorial a bit…but it isn’t working.
http://www.kirupa.com/developer/flash8/interactive_image_pan.htm
there are two things that I need to change. The way it currently is…the function is operating on any mousemove. So in other words, whenever you move around the mouse, the strip moves left and right.
I want to have it so that it is constrained to when you are rolling over a certain MC of thumbnails.
The other issue, which is related is that the code is using the width of the stage to calculate the move, but because my strip of thumbnails is an MC that is less than the width of the stage,…how can I modify the code to base it’s absolute left and right settings on the thumbnail MC instead of the whole stage.
If you can help me with this, I will be happy.
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 {
target._x += Math.ceil((target.destX-target._x)(speed/100));
}
};
}