Flash CS3 and AS 3.0 - Snow Scene

Flash CS3 and AS 3.0 - Snow Scene
In this particle system tutorial series we will be creating a snow scene animation with ActionScript and FlashR. For our scene, there are many snowflakes falling at the same time. Each flake falling on the stage will be one instance of the same movie clip. So we need to write ActionScript to animate all of the instances, or snowflakes, on the stage. We will use modular, or reuseable, code that can be used to animated as many flakes as we wish.

The best way to begin a series like this is to familiarize yourself with some of the terminology. In this first tutorial, we will take a general look at the function and function call. This function will move three flakes a certain number of pixels down the vertical axis.

To set the scene, I have created two layers in the Timeline which I have named "background" and "snowflakes". I have imported a background image into the Flash Library. With Frame 1 of the background layer selected, I dragged the background image on to the stage. Next, I imported into the Library the snowflake image as a movie clip with the name "mcSnowflake". We will animate three instances of this movie clip.

  1. Select Frame 1 on the snowflakes layer in the Timeline and drag one instance of the mcSnowflake movie clip from the Library to the top of the stage. In the Properties Inspector, give this snowflake an Instance Name of "snowflake1_mc".

    Repeat this for two more instances of the mcSnowflake movie clip. Name these instances "snowflake2_mc" and "snowflake3_mc". You should now have three flakes at the top of the stage ready to fall into the snow scene. Now, we will write the modular function that will create this animation.

  2. Create a new layer in the Timeline and rename this layer "Actions". Select Frame 1 on this layer and open the Actions Panel (Window – Actions). Type this code into the panel and then we will discuss the code.

    function snowfall(snowflake:MovieClip, movement:Number):void
    {
    snowflake.y = movement;
    }

    snowfall(snowflake1_mc, 10);
    snowfall(snowflake2_mc, 20);
    snowfall(snowflake3_mc, 30);

function snowfall():void

Continue





RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map








Content copyright © 2018 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.