Dec
12th

Creating Xmas Snowing Effect Using Flash

Files under Flash & Actionscript

This tutorial will help you how to write the Actionscript to create snow animation effects. It also specifies the properties to be set, the frames to be selected etc. Just follow the necessary steps and I will explain each step in detail.

showing_flash_01

Steps 1: Create a snow particle. Click the Oval tool from your toolbox and set the color to white from your color palette.

Steps 2: Then convert it to movie clip by right clicking on the circle.

Steps 3: Select your movie clip and go to the Properties panel and type the word “snow” in <Instance Name>.

snowing_flash_02

Steps 4: After that, right click on your movie clip and select Actions. Copy and paste your code into Actions dialog box.

onClipEvent (load) {

//this is to specify the size of the movie stage, if you set the value of width and height to higher then the distance between each snow particle will be greater.

movWidth = 380;

movHeight = 400;

// use the Math.random() function to create a random speed of snow particle. The variable i takes a random value between 1 and 2 for the speed of the falling snow.

i = 1+Math.random()*2;

m = -Math.PI+Math.random()*Math.PI;

this._xscale = this._yscale = 50+Math.random()*100; //to make sure that x and y dimensions scale evenly

this._alpha = 75+Math.random()*100; //to set the alpha (transparency) value between 75 and 100.

// randomly position the snow particles on your movie

this._x = -10+Math.random()*movWidth;

this._y = -10+Math.random()*movHeight;

}

onClipEvent (enterFrame) {

// convert the value from m into radians so that movie moves horizontally

radian += (m/180)*Math.PI;

this._x -= Math.cos(radian);

this._y += i;

//set the conditions so that the snow particle will disappear from the screen and appear and repeat the process over again

if (this._y>=movHeight) {

this._y = -5;

}

if ((this._x>=movieWidth) || (this._x<=0)) {

this._x = -10+Math.random()*movWidth;

this._y = -5;

}

}

Steps 5: Right click on the first frame in your movie and select Actions. Copy and paste the following code into the Actions dialog box.

for (m=0; m<50; m++) {

duplicateMovieClip(this.snow, “snow”+m, m);

}



One Response to “Creating Xmas Snowing Effect Using Flash”

  1. By Jayce on Dec 14, 2009 | Reply

    No snow demo?

Sorry, comments for this entry are closed at this time.