Forum Moderators: open

Message Too Old, No Replies

Detecting borders to end scrolling background

         

nonono25

10:49 am on Jul 25, 2006 (gmt 0)

10+ Year Member



Hi guys ; I need some help : I've got an interactive scrolling movie clip which uses the code below. But instead of having it loop endlessly, I need to have it stop scrolling when it hits the borders of its loader - i guess i need to put in the correct coordinates, but i don't know how! the clip is 1600p wide, and its loader is 550. Thanks in dvance!

onClipEvent (load)
{
xcenter=260;
speed=1/20;
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
}

onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
if (_x > 0) _x=-1600;
if (_x < -1600) _x=0;
}