Infinite Tiled Background?

I am creating a space game in AS3. In order to show movement while keeping your space ship in the center of the screen I would like to move the background (in the opposite direction that the space ship is moving). I would like the background to tile so that if you ever reach the end of one background image it will place another one right next to it seamlessly. I have worked out the code to move the tiles to the right place at the right time, however whenever the tile is repositioned due to the ship reaching the edge, there is a brief period of lag.

I’ve searched google for quite a while trying to figure out if there is a better way to accomplish what I’m trying to do, but have been unable to find anything.

Does anyone have any suggestions for getting rid of this lag? I will be eternally grateful for any advice!