/* copy and paste this code on the first frame of your movie and create need a bg movie clip put that clip in library */ import flash.display.MovieClip; import flash.events.Event; import flash.display.Sprite; import flash.events.MouseEvent; var max:Number = 800; var speed:Number = -5; stage.frameRate = 24; //a blank sprite thats hold the background var BgClone:MovieClip; //adding background movieClip; //defaut direction addbackground() function addbackground() { //minimum 2 for (var i:Number=0; i<2; i++) { var Bg=new bg(); this.addChild(Bg); Bg.x=(Bg.width/2)+Bg.width*i; Bg.y = Bg.height/2; Bg.addEventListener(Event.ENTER_FRAME,moveBg); } } function moveBg(e:Event) { e.currentTarget.x += speed; if ( e.currentTarget.x<-(e.currentTarget.width/2)) { e.currentTarget.x = 1190; } }
all about coding especially in javascript, daily used algorithms, react, angular and other gaming stuffs like webgl, pixijs, three.js and cocos2dx running code sample especially in javascript and c++.