15 Replies Latest reply: Mar 5, 2012 11:15 AM by lija30 RSS

    Scrolling background will not stop

    lija30 Community Member

      I am trying to make a horzontial flash scrolling background and I cant seem to get it to stop at the last frame.

       

      animator=createEmptyMovieClip('animator',1);
      bg_1=animator.attachMovie('bg_mc','bg_1',1);
      bg_2=animator.attachMovie('bg_mc','bg_2',1);
      bg_1._x=-bg_1.width/2;
      bg_1._x=-bg_2.width/2;
      speed=1;
      lockerWidth=550;
      animator.onEnterFrame=function(){
                bg_1._x-=speed;
                bg_2._x-=speed;
                if(bg_1._x<=-bg_1._width)bg_1._x=lockerWidth;
                if(bg_2._x<=-bg_2._width)bg_2._x=lockerWidth;
      }
      
      
      
      I have a attached a ms doc showing how it looks in flash