For some reason my parallax effect doesn’t work properly the front mc doesnt scroll quit right, you can see what i mean in the example i uploaded…
http://www.darrenleighton.co.uk/vp.html
I basically have a back mc and a front mc both the same size. Anyone got any ideas what iv done wrong?
heres my code:
stageWidth = Stage.width;
speed1 = 14;
speed2 = 16;
mc1Width = front_mc._width;
mc2Width = back_mc._width;
mc1X = front_mc._x;
mc2X = back_mc._x;
lock_scroll = false;
_root.onEnterFrame = function() {
if (!lock_scroll) {
scroll_mc();
}
};
function scroll_mc() {
var xdist = _xmouse-(stageWidth/2);
mc1X += -xdist/speed1;
mc2X += -xdist/speed2;
if (mc1X>=0) {
mc1X = 0;
}
if (mc1X<=stageWidth-mc1Width) {
mc1X = stageWidth-mc1Width;
}
if (mc2X>=0) {
mc2X = 0;
}
if (mc2X<=stageWidth-mc2Width) {
mc2X = stageWidth-mc2Width;
}
setProperty("front_mc", _x, mc1X);
setProperty("back_mc", _x, mc2X);
}
//create an empty mc container for content to display
createEmptyMovieClip("content_box", 200);
content_box._x = 195;
content_box._y = 92;