In our first FlashR particle system snow scene tutorial, we learned how to use a modular function and function call written in ActionScript to animate more than one instance of the same movie clip. This was a very simple way to perform this common task in Flash. In this second tutorial, we will take a look at more programming terminology. We will discuss code loops and how they can be used to perform a task as many times as you wish. At this point, we have our SnowScene1.fla file that contains three layers in the Timeline. The Background layer contains the background image. The next layer, called Snowflakes, contains three instances of the mcSnowflake movie clip from the Library. The top layer is the Actions layer where we have our ActionScript. But, three snowflakes aren't enough for our snow scene. We will need many more instances of the mcSnowflake movie clip to create the appearance that it is snowing in our scene. We could continue to drag instances from the Library and manually give each a unique Instance Name in the Properties Inspector. However, there is a better and more efficient way to do this with ActionScript. When you want your code to repeat the same task many times, you can write a code loop in ActionScript. Basically, this will be a block of code that uses an incremental counter to count the number of instances that are added to the stage. We will then tell Flash to repeat or loop this task until a certain number is reached. First, we need to make some changes to our SnowScene1.fla Flash movie. Open the file into Flash.
Next → | |