Hi
Ive created a new flash movie that pans an image when you move the mouse over it.
The problem I have is that I would like the movie to pan from right to left when the flash movie loads then pan in any direction when the mouse moves over it.
How would I modify the following code to do that?
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));
}
};
}
Many Thanks
Bilbo
:puzzle: