Continous Movement

This tutorial shows how to get continous movement of a MovieClip.

To understand how it works and to repeat this for your own clips position the two identical movieclips as indicated in the fla file. Now in the fla file move syma to x(496) and let syma2 follow. Syma2 is now at x(163). If you consider the width of each clip (325) multiplied with 2 (650) and consider a bit space betwenn the two clips (19) then when syma has reached x of 496 it has to go back -669. The same is then also true for syma2. Now place the clips back into their original positions.

We first create a movieclip "syma", which has the content to scroll. We put 2 instances of the clip consecutively. However, we have to also set 2 masks, one to each clip, so we put 2 instances of the mask on stage as well and give different names: here square and square2. The rest as you can see is just a number play with the x-positions.

stop();
//main function
function moveCont() {
	//setting the mask: "syma" and "syma2" are masked and "square" and "square2" are the masks.
	syma.setMask(square);
	syma2.setMask(square2);
	//setting all positions for syma
	pos1Symax = syma._x;
	//parent position x
	pos1Symay = syma._y;
	myTimer = new Object();
	myTimer.interval = function() {
	   syma._x += 2;
	   syma2._x += 2;
	   //position for syma and syma2 to go back
	   if (syma._x>=496) {
	       syma._x = -173;
	   }
	   if (syma2._x>=496) {
	       syma2._x = -173;
	   }
	};
	timer = setInterval(myTimer, "interval", 20);
}
moveCont();