Hello,
I am trying to create time-line that moves in the direction of the mouse movement but then will stop whenever I hover over an area. In other words, I have links on the time-line that I want to be able to stop at by hovering over the button. The code listed below is what I am using for the x and y background movements:
(What am I missing to get the background to stop when I hover over a button?)
this.onMouseMove = function() {
constrainedMove(bg2_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/300));
}
};
}