Hi everyone.
I have a problem with a "paralax scroller" movie clip. I downloaded the original from this site and I'm currently modifying it. Currently I'm loading it into the .swf as another .swf like this:
Code:
loadMovie("parallax_01.swf", parallax_mc);
which is fine.
My problem is that it continues to scroll even when the mouse isn't over it. Please check it out here to see what I mean. As you can see, it works perfectly, as long as the mouse remains within the bounds of the loaded .swf, but once outside those bounds - ie outside the box - it continues to scroll (which is bad).
Can anyone help me modify my code so that this can be fixed? I guess its something about checking where the mouse is? getBounds maybe? The code governing the movement is inside the loaded "parallax_01.swf" and reads as follows:
(foreground layer)
Code:
onClipEvent (enterFrame) {
if (_root.parallax_mc.mainVar == 0) {
homeX = (-_root.parallax_mc._xmouse*3)+540;
} else {
homeX = (-_root.parallax_mc.mainVar*3)+540;
}
thisX = _x;
diffX = homeX-thisX;
if (_root.parallax_mc.mainVar == 0) {
moveX = diffX/30;
} else {
moveX = diffX/5;
}
_x = thisX+moveX;
}
(middleground layer)
Code:
onClipEvent (enterFrame) {
if (_root.parallax_mc.mainVar == 0) {
homeX = (-_root.parallax_mc._xmouse*2)+405;
} else {
homeX = (-_root.parallax_mc.mainVar*2)+405;
}
thisX = _x;
diffX = homeX-thisX;
if (_root.parallax_mc.mainVar == 0) {
moveX = diffX/30;
} else {
moveX = diffX/5;
}
_x = thisX+moveX;
}
(background layer)
Code:
onClipEvent (enterFrame) {
if (_root.parallax_mc.mainVar == 0) {
homeX = (-_root.parallax_mc._xmouse)+270;
} else {
homeX = (-_root.parallax_mc.mainVar)+270;
}
thisX = _x;
diffX = homeX-thisX;
if (_root.parallax_mc.mainVar == 0) {
moveX = diffX/30;
} else {
moveX = diffX/5;
}
_x = thisX+moveX;
}
I'm sure its fairly simple but I just can't figure it out. Thank you for looking I really appreciate it.