PDA

View Full Version : Scrolling horizontal movie clip continued...



s_e_b_design
03-10-2005, 11:22 AM
Further to previous, if I have a movie clip which is 1200 px wide for example (e.g. the menu bar twice) and I want it to scroll continuously depending on mouse position what values do I need to put into code to get the menu bar to appear continuous and where should I position it for the initial x value? at 0?

Thanks to the posting I can get the movement working but experiencing large gap between end of one and beginning of other.

Also if I then want it to stop scrolling with a mouse over where does this fit into the scripting?

Thanks

Sarah

NTD
03-11-2005, 11:16 AM
Hi,

You can put in some trace actions to determine the exact coordinates that need to be set for the scroll to loop precisely....

Pseudo code example...set boundaries


_root.onEnterFrame = function () {
trace(_root.scrollMC._x );
// set the scroll
if (_root._xmouse>300) {
_root.scrollMC._x -= 5;
&#125; else if &#40;_root._xmouse<300&#41; &#123;
_root.scrollMC._x += 5;
&#125;
//set the bounds
if &#40;_root.scrollMC._x<=-50&#41; &#123;
_root.scrollMC._x = -50;
&#125; else if &#40;_root.scrollMC._x>=500&#41; &#123;
_root.scrollMC._x = 500;

&#125;


Pseudo code...Continuous scroll



onClipEvent &#40;enterFrame&#41; &#123;
trace&#40;_root.scrollMC._x&#41;;
if &#40;_root._xmouse>100&#41; &#123;
_root.scrollMC._x -= 10;
&#125;
if &#40;_root._xmouse<100&#41; &#123;
_root.scrollMC._x += 10;
&#125;
if &#40;_root.scrollMC._x<-450&#41; &#123;
_root.scrollMC._x = 850;
&#125;
if &#40;_root.scrollMC._x>950&#41; &#123;
_root.scrollMC._x = -350;
&#125;

&#125;