How to make a infinite SMOOTH scrolling background?
This is what I have done:
var BGround1:Background=new Background();
var BGround2:Background= Background();
stage.addChild(BGround1);
stage.addChild(BGround2);
addEventListener(Event.ENTER_FRAME, moveScroll, false, 0, true);
function moveScroll(e:Event): void
{
BGround1.x -= scrollSpeed;
BGround2.x -= scrollSpeed;
if(BGround1.x <= -BGround1.width)
{
BGround1.x =BGround2.x + BGround2.width;
}
else if(BGround2.x <= -BGround2.width)
{
BGround2.x = BGround1.x + BGround1.width;
}
}
However, If I set scrollSpeed too high, the movement is not smooth. Is there any way to make a smooth animation?
Thanks in advance.
PS: I dont know how to put the code into code tag.
