3 Replies Latest reply on Aug 20, 2011 11:16 PM by kglad

    Help with a Endless Scrolling Background AS

    fiveflightsup Level 1

      I've been trying to recreate the tutorial in the link below.

       

      http://www.pixelhivedesign.com/tutorials/Endless+Scrolling+Background/

       

      And believe I've followed the instruction, but my actionscript only generates 1 movieclip rather than the 2 required to create the desired effect.

       

      Below is the action script that I typed on in AS2 on the first frame as instructed in the tutorial.

      Could someone look this over and explain what I've done incorrectly?

       

      animator = createEmptyMovieClip('animator',1);
      bg_1 = animator.attachMovie('bg_mc','bg_1',1);
      bg_2 = animator.attachMovie('bg_mc','bg_2',2);
      bg_1._x = -bg_1.width/2;
      bg_2._x = bg_2.width/2;
      speed = 1;
      cloudWidth = 380;
      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;
         
      }