# Continuous background loop

**URL:** <https://forum.kirupa.com/t/continuous-background-loop/284931>\
**Category:** Uncategorized\
**Created:** [March 25, 2009, 8:10am UTC](https://forum.kirupa.com/t/continuous-background-loop/284931 "2009-03-25T08:10:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jynx](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@jynx](https://forum.kirupa.com/u/jynx)\
**Post date:** [March 25, 2009, 8:10am UTC](https://forum.kirupa.com/t/continuous-background-loop/284931/1 "2009-03-25T08:10:56Z")

</div>

I am making a cloud background continuously loop using actionscript, however the image cuts itself off. I cannot figure out what the problem is. I was following the tutorial at: [http://www.pixelhivedesign.com/tutorials/Endless+Scrolling+Background/](http://www.pixelhivedesign.com/tutorials/Endless+Scrolling+Background/)

I attached a picture of what it looks like. Here’s my code(very similar to above websites code)

```auto
animator = createEmptyMovieClip('animator',1);
bg_1 = animator.attachMovie('cloudsMC','bg_1',1);
bg_2 = animator.attachMovie('cloudsMC','bg_2',2);
bg_1._x = -bg_1._width/2;
bg_2._x = bg_2._width/2;

speed = 25;
cloudWidth = 1500;
animator.onEnterFrame = function(){
 bg_1._x -= speed;
 bg_2._x -= speed;
 if(bg_1._x <= -bg_1._width) bg_1._x = cloudWidth;
 if(bg_2._x <= -bg_2._width) bg_2._x = cloudWidth;
}

```

This code is all in a movieclip named bg\_mc.

The width of cloudsMC is 1500 px.

Any idea why the image cuts off as it scrolls to the left?
