|
Written by Chetankumar Akarte
|
|
Thursday, 03 May 2007 |
|
Page 3 of 4
Create SnowNow 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…
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.
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.
Select ‘Scene 1’. And drag movie clip ‘snow’ form library. And modify its property. Give it an instance name as ‘snow’. Refer fig 5.
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 )
|