adv banner
Flash & Swish  Home Flash & Swish Flash Tutorials Snow Effect With Wind
rss

Snow Effect With Wind

Author: Stilva.com More by this author


1. Make a new 300×200 flash document, and set its Background colour to something else than plain white (I used #CCCCCC here)

2. Let's start by adding this Action Script in the first Layer, First Frame:

image 1

speed1 = .9;
mw =300;
//Movie Width
mh = 200;
//Movie Height
snowint =50
//the larger the interval is, lesser it's going to snow
//++++++++++++++++++++++++++
function randRange(min, max) {
var randomNum = Math.round(Math.random()*(max-min))+min;
return randomNum;
}
setInterval(CursorMovement, 40);
function CursorMovement() {
mc._x = speed1*(mc._x-_xmouse)+_xmouse;
interval = (mc._x/mw*6);
}
function snow() {
i++;
duplicateMovieClip(snowflake, ["snowflake"+i], i);
}
setInterval(snow, snowint);

3. Now go to Insert -> New Symbol -> Movie Clip, Name it SnowFlake.

Select the Oval tool, and make sure that the Stroke Colour is set to No Color, and that the Fill Colour is set to White:

image 2

Now with the Oval tool you selected, draw a circle while pressing SHIFT (to make it a perfect circle), and make sure you center it with the align tool.

4. Now go back to the main stage/Scene 1:

image 3

Drag&Drop, the movie clip SnowFlake you just made and give it: snowflake as its istance name.

And, attach this Action Script to the movie clip SnowFlake you just Drag&Dropped

onClipEvent (load) {
if (this._name == "snowflake") {
_parent.i = 0;
}
this._alpha = _parent.randRange(80, 100);
//Alpha Transparency of snowflake
this._width = _parent.randRange(5, 10);
//Snowflakes' width
this._height = this._width;
//Keep round shaped snowflakes
this._x = _parent.randRange(-100, _parent.mw+100);
this._y = _parent.randRange(0, -50);
speed = _parent.randRange(2, 5);
//Folling speed.
}
//+++++++
onClipEvent (enterFrame) {
this._y += speed;
this._x += _parent.interval-3;
if (this._y>_parent.mh+20) {
this.removeMovieClip();
}
}

5. Go to Insert -> New Symbol -> Movie Clip, Name it MC.

Keep it blank, and go back to the Main Stage/Scene 1

image 4

Drag&Drop the movie clip MC to the Main stage, and give it:mc as its instance name.

image 5

And you're done. Happy holidays/Merry Christmas, and happy new year.



Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "Snow Effect With Wind"