1. Home
  2. Computing & Technology
  3. Animation

Flash Falling Snow with Random Functions and Movie Clips

By , About.com Guide

7 of 10

The vertical (y) position is similar to the horizontal, only rather than starting at 0 (the top edge of the stage) it starts at -75, so that some of the flakes will fall in from off-stage but others will already be partway down the stage when the movie first loads. It also multiplies by a value slightly greater than the height.

The _alpha parameter is set as a percentage between 0 and 100, so setting the alpha to a value of 90 would mean that the snowflake is 90% opaque. To set a random opacity for the snowflake, the section dealing with _alpha generates a random decimal and then multiplies it by 100 to assign a random alpha value.

Like the _alpha parameter, _xscale and _yscale are percentages set by the numbers 0 to 100. Rather than generate a separate random number for each, instead we assign a single random number to the variable size, and then use an if statement to determine that if the value of size is greater than or equal to 25 but less than or equal to 100. This ensures that the snowflakes generated aren’t too small to see. If the snowflakes meet those criteria, then we set the percentage of the _xscale and _yscale parameters to equal the value of size. If not, then an else statement sets the scale to 90%.

Explore Animation
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Flash Falling Snow with Random Functions and Movie Clips

©2009 About.com, a part of The New York Times Company.

All rights reserved.