Skip to content

TechXcel.com - provides technical excellence...

Narrow screen resolution Wide screen resolution Increase font size Decrease font size Default font size default color orange color green color
You are here: Home
Falling Snow Effect PDF Print E-mail
(12 votes)
Written by Chetankumar Akarte   
Thursday, 03 May 2007
Article Index
Falling Snow Effect
Create a new document
Create Snow
Source Code

Create Snow

Now we are going to generate Snow. Press Ctrl+F8 or Insert > New Symbol… to add new symbol. Name it ‘snow’. Modify its property as per following figure…

Image

Now select movie clip ‘snow’ form library by double clicking it. Now select Oval tool and set Stroke Color is set to No Color, and that the Fill Color is set to White.

Image

Draw a small circle. Press shift button for perfect Circle. Set its property as shown below…

You can modify width and Height as you wish. And align to ‘0’ will better.

Image

Select ‘Scene 1’. And drag movie clip ‘snow’ form library. And modify its property. Give it an instance name as ‘snow’. Refer fig 5.

Image

Now go to action panel by pressing F9 or through Windows > Actions paste following piece of code (code 1) there.

Code 1

onClipEvent (load) {
if (this._name == "snow") {
_parent.i = 0;
}
this._alpha = _parent.randRange(80, 100);
//Alpha Transparency of snow
this._width = _parent.randRange(5, 10);
//Snow width
this._height = this._width;
//Keep round shaped snow
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();
}
}


Now create a new movie clip ‘snow_bit’ same as you do for ‘snow’. Drag ‘snow_bit’ on ‘Scene 1’. Give it an instance name as ‘snow_bit’.

Select first frame of ‘Scene 1’ and add following source code to action panel.

Code 2

speed1 = .9;
mw = 400; //Movie Width
mh = 300;//Movie Height

snowdrop = 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() {
snow_bit._x = speed1*(snow_bit._x-_xmouse)+_xmouse;
interval = (snow_bit._x/mw*6);
}
function snowfall() {
i++;
duplicateMovieClip(snow, ["snow"+i], i);
}
setInterval(snowfall, snowdrop);

Now publish .swf file. You can do it through
File > Publish Preview > Flash / HTML or press F12



Last Updated ( Monday, 23 July 2007 )
 

Who's Online

User Login

PayPal Donation

Enter Amount:

Syndicate

TechXcel's Friends

Tutorials Garden
Wicolorz
pixel2life

Text Link Add

Statistics

Members: 276
News: 60
Web Links: 6
Visitors: 348264

Google Seach

Google AdSense

TechXcel Referrals

TechXcel's Sponcer...