MemoclipWe first create our movieclip, which we want to repeat a few times. I have created a movieclip called "wheel", which consists of a number of other movieclips, which we let rotate with different speed and different sense. The actionscript for rotating the movieclips is shown here for one of them: this.onEnterFrame = function(){ this._rotation+=30; }The "plus" gives the direction and the number (here "30") determines the speed. Actionscript for main functionThis script is in frame 1 of the movieclip"theWheel". //we set i equal 1 i=1; //we create the function to make new wheels function duplicateWheel(){ //we create an array for the different colors myCol = new Array(); //the first array object is null, since we start with 1 myCol = [null,0xFF0000,0x00FF00,0x0000FF,0xD63194,0xBDC6DE,0xFF9C4A]; //here we set the intervall function and first define var myTimer = "timer_"+i; myPause = "pause_"+i; myPause = new Object(); myPause.interval = function() { //positioning the wheel var x = 25 + (25*i); //a number of var for the duplicateMovieclip method var j = i+2; var n = 1; var m = i+n; newWheel = "wheel_"+j; duplicateMovieClip("wheel_1",newWheel,m); //positioning the wheel, use "eval" here, because it is a virtual //wheel in a var and no absolute name with(eval(newWheel)){ _x = x; _y = x; } //setting the new color myColor= new Color(eval(newWheel).tire); //calling the array myColor.setRGB(myCol[i]); //we increment i if(i < 7){ i++; } //we terminate the loop if(i > =7){ //stop incrementing, stop intervall and remove the wheels i; clearInterval(myTimer); removeWheel(2,8); } } //calling the intervall function myTimer = setInterval( myPause, "interval", i*1000); } //we create the function to remove the movieclips function removeWheel(a,j){ for(n=a;n(smaller*)=b;n++){//we make loop to get all movieclips wheel = "wheel_"+n;//we make the var "wheel" holding all clips removeMovieClip(wheel); } } //calling the duplicateWheel() function duplicateWheel(); |