Rain Effect in flash

Steps for rain effect in flash

1) create rain drop movieclip

2) Add linkage name by right_click symbol in library select linkage

3) In Linkage properties Dialog box select Export for actionscript check box and rename identifier: drop

4)slect first frame and press F9 Paste the below code in Action panel

var rain_speed:Number = 8;
var rain_direction:Number = 4;//negative values accepted
var rain_density:Number = 100;
_root.createEmptyMovieClip("rain_mc", _root.getNextHighestDepth());
for (i=0; i<=rain_density; i++) {
_root.rain_mc.attachMovie("drop", "drop"+i, _root.rain_mc.getNextHighestDepth(), {_x:Math.random()*Stage.width, _y:Math.random()*Stage.height, _rotation:-50});
var inter = setInterval(function () {
for (i=0; i<=rain_density; i++) {
_root.rain_mc["drop"+i]._y += rain_speed;
_root.rain_mc["drop"+i]._x += 5;
if (_root.rain_mc["drop"+i]._y>Stage.height) {
_root.rain_mc["drop"+i]._y = 0;
} else if (_root.rain_mc["drop"+i]._x>Stage.width) {
_root.rain_mc["drop"+i]._x = 0;
} else if (_root.rain_mc["drop"+i]._x<0) {
_root.rain_mc["drop"+i]._x = Stage.width;
}, 20)

Bookmark and Share


Babu said...

Very Nice. U creative flash actionscript. superb. so u small mistake 90 degree rotate.

content online said...



Recent Posts

Recent Visitors

Donate Me

About Me

My photo
Chennai, Tamil nadu, India
Nothing more to say about me.. Just a Action Script programmer / Flex developer having 4.5 years of experience.