actionscript-3flashflash-cc

ActionScript 3/Flash CC - Loop background


I just started learning AS3, I've been using Adobe Flash for a while.

I'm making a simple "Avoiding Game",
but the problem is that I want the background with stars (white dots) to move, but eventually it will run in to it's end (white space).

I made a temporary solution by copy/paste:ing the bg over and over again, but it only lasts a few minutes.

Is there a way to loop the background?

or even better:

Is there a way to random generate moving stars?

I guess it's quite simple, but I'm a newbie.

Manually looped background


Solution

  • I made a temporary solution by copy/paste:ing the bg over and over again


    If you are familiar with the Timeline, I will give you simple solution.

    Yes, you need to copy/past your background, but only once.
    Stack original and copied background, so copied version begins at the end of original background. Create animation by offsetting original background on it's width, so copy version of the background will be in the same place - at start.

    Now you will have infinite loop for the background, because first and last frames are equal ;)