Hello
Im using this piece of code in the Main stage, on the first frame, while my Mc is called bg_mc.
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 = mousePercent;
} else {
mSpeed = 1-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));
}
};
}
BUT, it only works if the code is applied to the first frame on the main stage.
How do i make an Mc, inside another MC (ex: Stage ->Mc1->Mc2), scroll when i move the mouse?