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.
- 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. - 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);
Continue