Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Creating Rain Using Actionscript



hello all, i am quite new to flash and am looking for a way to create rain using actionscript (or by any other means than animating each separate drop) i have checked out the examples on the site but cannot make head nor tail of them, as i mentioned before i am quite new to the wonders of flash. if anyone ould help me out with a way to do this or even help me to understand how to use the examples on the site it would be greatly appreciated. thankyou



FlashKit > Flash Help > Flash ActionScript
Posted on: 06-12-2005, 06:14 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Creating Rain In Flash Using Actionscript.
Does anybody know how to make rain in FlashMX using actionscripting? I thought it would be a neat idea to have a layer of realistic looking rain in a flash movie but i have fairly limited knowlegde of actionscripting to do so. For ne advanced coders out there i was hoping u could help me. I have a theory as to how this can be done... Basically four sub programs...

1. One that creates random amounts of single pixeled particles with the same color but random alpha levels.

2. Next a Gravity program (like in the Kirupa Tutorial), that will make the particles fall.

3. A simple program that as the particles fall makes them all fall at the same varying angle (ex. wind movements to rain).

4. And lastly and program (simlar to mouse trails) that makes the particles create a fading trail as they fall from whatever they base alpha level is. (ex. a particle that starts as 70% Alpha has a trail of 12 1 pixeled particles that follow it each dereasing by 5% Alpha.)


I'd like to see and understand the programming behind this for neone interested in helping me endeavor in this lil experiment. I won't lie to u, it will probably have the same complexities as that of Kirupa's snow. But i think it would be an interesting tutorial to place on his site.


Just a Thought....

Regards,
-Blackfire

P.S. Attached is an example of what the rain might look like. Personally I like the none blurred 2nd half of the picture. Plus it is easier to program.

Creating Rain In Flash Using Actionscript.
Does anybody know how to make rain in FlashMX using actionscripting? I thought it would be a neat idea to have a layer of realistic looking rain in a flash movie but i have fairly limited knowlegde of actionscripting to do so. For ne advanced coders out there i was hoping u could help me. I have a theory as to how this can be done... Basically four sub programs...

1. One that creates random amounts of single pixeled particles with the same color but random alpha levels.

2. Next a Gravity program (like in the Kirupa Tutorial), that will make the particles fall.

3. A simple program that as the particles fall makes them all fall at the same varying angle (ex. wind movements to rain).

4. And lastly and program (simlar to mouse trails) that makes the particles create a fading trail as they fall from whatever they base alpha level is. (ex. a particle that starts as 70% Alpha has a trail of 12 1 pixeled particles that follow it each dereasing by 5% Alpha.)


I'd like to see and understand the programming behind this for neone interested in helping me endeavor in this lil experiment. I won't lie to u, it will probably have the same complexities as that of Kirupa's snow. But i think it would be an interesting tutorial to place on his site.


Just a Thought....

Regards,
-Blackfire

P.S. Attached is an example of what the rain might look like. Personally I like the none blurred 2nd half of the picture. Plus it is easier to program.

Creating Rain
hey all ive got a real weird request,

im trying to make my site look like its raining and the rain drops are hitting water.......

ive got 4 different movies of ripples where the rain hits water. These play then fade out subtley and are all at different speeds and sizes.

I want them to play in a random order and at a random position towards the centre of the screen

Also to make things more complicated i want there to be lots of them all at a random places, and when they loop and dissapear they are in a new place.

sorry if this is hard to understand

I thought maybe using duplicate movie but never really used this function much, any ideas??? anyone???

Thanks Phenia

Actionscript Rain
Hi everybody!
I´m trying to do some rain animation effect but with actionscript.
I basically started with a Movie Clip with a single line that moves down. Then I tried to duplicate it and at last to move the animation and its duplicates randomly trough the stage to get the "rain illusion". My biggest problem is that all the lines seems to fall down at the same time, so it seems to be more like a laser fight then a rainy day!!!!

Please can anyone of you be se kind to make a little .fla to use like example and to learn how to get this effect achieved??
Thank you very much!
Best regards,

Strato.

Actionscript Rain
Hi,

I've been wondering how to make a good rain effect with actionscript .... anyone got any ideas?

Proto

Actionscript For Rain Effect - Is This Right?
Hi,

I've been trying to create a rain drop effect in my flash document. First I created a raindrop movie clip symbol. Then I wanted to place it in the stage and recreate it many times using action script.

The following are the Action scripts I used (I am a novice in ASP)

1) Set variable
2) duplicatemovieclip
3) set property of x position

I wanted raindrops to be duplicated randomly along the x scale of the screen. But it's not at all working. I tried using various values of 50, 100, 10 etc. for duplicating along x axis . but still not working out.

Is this correct or have I missed out something important?

Rain, Rain Come My Way :)
i saw once a .swf that had a sort of collision thing going on. what I want to do is have rain drops falling and when in hits a certain spot have a sort of ripple effect going on. I was just wondering what script i would use. I can set it up as just a movie clip and manually make it do all of the above but i was just wondering if there was a script.

thanks guys

Rain In A Box
I know it's possible to make a rain effect using mostly A.S. but what I'd like to do is put the rain in a box I make in flash. What I am wondering if I should just do it as an animation or if I can still use mostly A.S. to make the rain but some how contain it. Is it just a matter of keeping it all in a m.c. and then bringing that m.c. onto the main stage where I have the box? The A.S. needs to be contained.

Thanks for any help.

Rain
I am making a movie where in the first few frames it is raining, how do I make the rain loop till the next frame which is sunny?

Less Rain
Im having problem with my site.

on www.lessrain.com the background image is scale to whatever the browser is stretched too yet the main interface remains at the same scale.


Help....and cheers for it.

Rain
Hi all,

I found a animation which duplicates a raindrop movie clip. However, when I try and publish in anything higher than flash 6, it stops working. Here's the script...

this.onEnterFrame = function(){

b = random (60);
a = random (468);
b2 =b*4
alpha = alpha+1;
duplicateMovieClip("rain", alpha, alpha);
setProperty(alpha, _x, a);
setProperty(alpha, _y, b);
setProperty(alpha, _xscale, b2);
setProperty(alpha, _yscale, b2);
if (alpha>40) {
alpha = 0;
}
}

Any ideas how I can get it to work in flash 8?

Cheers

Rain
Hi
Ive been looking around the web for some nice rain. But the ones i find are not to real looking. Anyone got some ready made rain out there? Its for putting over a picture of rainy weater. If theres some water in the pictures it would be cool to have some rings there.

Anyone got some scripts or files one could modify easily?

Rain, Rain Go Away...
Hello All:

I'm using the following code to create a very cool rain effect. Problem is, I only want the rain to last about 10 seconds, then I'd like it to fade away. I can get the background to fade, but the raindrops still appear.

Anyone know how I can accomplish this?

TIA


Code:
for (i = 0; i < 50; i++)
{

var newDrop = mcRaindrop.duplicateMovieClip ("mcRaindrop" + i,
i);
newDrop._x = random (350);
newDrop._y = random (20);
newDrop._xscale = random (100);
newDrop._alpha = random (50);
newDrop.gotoAndPlay (random (40) + 1);
}

for (j = i; j < i + 100; j++)
{
var newDrop = mcRaindropSlow.duplicateMovieClip (
"mcRaindropSlow" + j, j);
newDrop._x = random (350);
newDrop._y = random (20);
newDrop._xscale = random (100);
newDrop._alpha = random (25);
newDrop.gotoAndPlay (random (80) + 1);
}

Rain?
Hello All,

I am looking for a tutorial or someone to show me how to create rain in my Flash MX file. This rain will be going into an existing scene that I have created. Any help is greatly appreciated.

Thank you.

Mike

Rain Effect?
What's the easies way to make a realism rain effect using flash mx?
Thnx

Random Rain
==background info==
well, i'm pretty new to actionscript. i breezed through "ActionScripting in Flash MX" by Phillip Kerman. it's mostly a conical reference in my opinion. i have a strong programming background. eep, i forgot to say i use Flash MX.

==the rest==
well, at first i wanted to see if i could make a set amount of duplicated movie clips run across the screen. then i made them randomly lose their opacity. wooo..fun. well, i though, i could apply this vertically and make rain! so i made my little rain drop mc, and applied the script, but alas, it looked fake.

code at frame 1 of main timeline:

Code:
for ( i = 0; i < 100; i++ ) {
_root.rain_drop.duplicateMovieClip( "copy_"+i, i );
}
code at frame one of rain_drop mc:

Code:
width = 800;
height = 600;
base_speed = 10;
random_speed = Math.ceil(Math.random()*((50)+1));
random_y = Math.random()*((height)+1);
this._y = random_y;
random_x = Math.random()*((width)+1);
this._x = random_x;

this.onEnterFrame = function() {
this._y += random_speed+base_speed;
this._alpha -= 5;
if ( this._y > width ) {
this._y = 0;
this._alpha = 100;
}
}
like i said, "it worked". hehe. anyway, this is what i'm working from. probably not the most elegant, object-oriented solution...call it my "rough draft"

==real question==
after realizing my rain looked fake, i embarked on a soul searching mission to make it look real. ( my friend said it looked like "sheets...sheets of arrays"..whatever that means.. ) my plan, use a stack to control the amount of rain on the screen while allowing rain to have random x/y coords every time. is this doable? am i just stupid? i tried it myself, but i think the stack was running out before it had a chance to push back on the array. something like this ( in pseudocode ):

initial array to amount of rain drops wanted
while there are "rain drops" in the array
shift a drop
duplicate mc and let it do it's thing
endwhile

then in the mc:

do stuff to make the rain drop fall
remove movie clip that was duplicated
push back onto the stack


do i have some sort of logic error? am i thinking about this too hard? i just want to understand flash better, and i thought this was a good way to learn :) thanks for your help and time.

Rain Drops?
I am trying to get these rain drops to look right. I tried a movie clips but it doesn't seem to work right. This may be because I am creating a motion tween instead of frame by frame. How would you make these rain drops look like it's raining?
http://lupostudio.com/ecard5.html
Thanks for your help,
Moethejoe

Rain Effect
doesnt anyone know a great tutorial to a rain effect were i can learn how to make one please?

How To Make Rain?
making a cartoon for fun and i need a quick easy way to make an overlay of rain. it's raining on a house at night and it doesn't have to look TOO real- just as long as you can tell it's rain. thanks in advance.
<~jester45~>

Rain Effect
Anybody have a tip on how to make rain look like its falling? When I try to it looks all crappy
thanks in advance

Rain With Duplicated Mc's?
Hi, I'm wondering if anyone could help me create rain by duplicating the movie clip "raindrop" and placing it randomly at the top of the stage. (The width of the stage is 954 px) Can anyone help me out?

Thanks in advance!

Falling Rain
ok, anyone know of a way to simulate rain fall in flash? i've seen a few shoddy examples in swish but i really need a quick fix so i can get on with my web site.

[F8] Rain Effect
Hey everyone, was wondering how you would create a realistic rain effect using flash 8?

[F8] Random Rain
Hello all,

i'm using the rain effect as found on http://flashrandomeffects.webarticle...ain-effect.php.
They use a movie that is 100x200 i am trying to use a movie that is 800x200. My random rain code looks like this
Code:
xx = -1-random(1000);
// generates an integer number between 0 and 199
setProperty(_target, _x, xx);
// sets the horizontal position to a value between 0 and 199
yy = 30-random(200);
// generates an integer number between -60 and -31
setProperty(_target, _y, yy);
//sets the horizontal position to a value between -60 and -31

scale = 70 + random(30);
setProperty(_target, _xscale, scale);
setProperty(_target, _yscale, scale);
However the rain dosen't cover all the ground. Look at http://youth.thryve.com/header.swf for the swf if someone would like the fla i can upload it.

Thank you,
Brandon

[CS3] How To End This Rain Animation?
Hi, this might seem like kind of a dumb or simple question, but it's been agonizing me for a while. On my site, I employed the rain animation code found here:

http://www.flashkit.com/movies/Effec...1418/index.php

It's more or less exactly the same code with very little things changed.


I have the rain animation playing through one of my scenes, but when you go to another scene, the rain persists! It looks terribly out of place.

So, I suppose my question is,

how do I get the rain to stop? (and to continue when you return to the appropriate page) I've tried a variety of things, but I'm a relative bonehead when it comes to scripting...

Rain Effect
hi there, would anyone have a good script to create a rain effect in cs3?

Realistic Rain?
Hi, I was looking around, and I can't seem to find a realistic rain effect using simple lines in flash mx?

All I was looking for is a diagonal down left rain effect using white lines which vary in size and alpha, anyone got any ideas?

Also, not sure if this is hard or not, but I need the rain to appear inside a mask, so that it doesn't "rain" all over the page, just in one area?

All help is much appreciated.

Regards
NoRegrets

Rain Animation?
I'm making myself a banner with photoshop and flash 5, in the background I want it to be raining, but i'm not to sure how to do this, can anyone help?

The banner I want to use is uploaded

Rain With Splash
Alright, I am a total noob to AS so here is my problem:

I have some rain that falls and hits an instance of an MC called Pavement. I want it to create and MC called Splash (The name in the library).
Rain: (I already have the moving stuff thanks to a tut!)

Code:
if (hitTest(_root.Pavement)) {
i ++;
duplicateMovieClip(_root.Splash,"Splash" + i,1);
this._alpha = 0;
trace("Hitting");
}
Splash:

Code:
this._x = _root.Rain._x;
this._y = _root.Rain._y;
trace("Created");
Thanks a ton,

Can't See Rain Code
hello all, I'm very new to this whole actionscript thing and was hoping someone could help me out. I have this Rain code that I'm trying to insert in my movie but it won't play at all. I can see it by itself but when I try putting it with other actionscript code it won't do anything. Is there a way to get this code to play in the foreground over everything under it? Thanks


Code:
function createRain()
{
this.createEmptyMovieClip("rain" + (++this.HL), this.HL).onEnterFrame = function()
{
(this._y += 20) < 400 ? this._x += Math.random() * 4 - 2 : this.removeMovieClip();
};
this._parent.createDrops(this["rain" + this.HL]);
}
function createDrops(t)
{
for (var c = 0; c < 70; c++)
{
t.lineStyle(1, 0xFFFFFF, Math.random() * 10 + 15);
x = Math.random() * 400;
y = Math.random() * 600;
t.moveTo(x, y);
t.lineTo(x + Math.random() * 4 - 2, y + 25);
}
}

this.createEmptyMovieClip("rain", ++this.HL);
this.rain.onEnterFrame = createRain;

Random Rain
On a couple of peoples footers, I've seen that random rain effect, is it possible without much as? (does anyone know what i'm even talking about?)

Rain Effect Help?
Hello, I'm looking for some help on creating a rain effect a website I'm developing.

I've seen tutorials on how to create a rain effect, except for one problem: they all add "splashes" at the bottom, to resemble what would happen if a rain drop would hit an object on the ground (water, pavement, etc). I need the effect to travel downward and to the right diagonally, and go completely from the top of the screen, to a point past the bottom where it would no longer be visable. In short, I need the rain drops to travel diagonally from top to bottom without interuption.

I've tried using the blur timeline effect to acomplish this, but to no avail. As I am still new to Flash, I really have no other ideas on how to accomplish this, maybe with a random math function like the one used in the "Snow 2.0" tutorial on this site?

Any help would be greatly appriciated and I would like to thank you in advance for any help and/or consideration any of you give to my plea.

Rain In Flash
I remember finding a tutorial on a rain effect in Flash MX 2004, but have since reformatted and lost the data. Does anyone know where a good tutorial is?

Regards,
THEfish!

Rain Effect
Can someone show me a tutorial that would help me out on creating a rain effect thx

Making Rain
I need some help making some rain fall from a cloud. Well, not actually rain, it will be hearts. I modified some code found online from a snow tutorial in hopes to get it working. Its close but still off. I've attached the piece for review and help. I'm having issues with the depth and placement of the movieclips. Everything is inside the cloud movieclip as far as code and the heart goes. Any help would be appreciated. Attached is the file.


Thanks

Making Rain
I've been working on an animation for a little while now and I've just got a point where I'm trying to insert rain and i realised i have no idea how I'm going to do it, I was wondering if any of you have any ideas for me to go by?

I dont mind how it's done, drawn into every frame, a movie clip or anything else you can think of.

An added bonus is if I can get and effect of the rain hitting things in the frame, if i knew how to do rain by drawing frame by frame then i could get that effect quite easily but I'm completely clueless.

It doesn't have to be realistic rain, cartoon or life-like would both go down well.

I look forward to your ideas

Cheers

Simple Rain
The Simple rain. The Code of the first frame. Tween it is used
http://kind-armadillo.pochta.ru/FlaAC3/Mod_rain_ac3.swf
http://kind-armadillo.pochta.ru/FlaAC3/mod_rain_ac3.rar

Animate Rain?
Does anyone know how to animate rain?

Realistic Rain?
Hi, I was looking around, and I can't seem to find a realistic rain effect using simple lines in flash mx?

All I was looking for is a diagonal down left rain effect using white lines which vary in size and alpha, anyone got any ideas?

Also, not sure if this is hard or not, but I need the rain to appear inside a mask, so that it doesn't "rain" all over the page, just in one area?

All help is much appreciated.

Regards
NoRegrets

Rain Animation?
I'm making myself a banner with photoshop and flash 5, in the background I want it to be raining, but i'm not to sure how to do this, can anyone help?

The banner I want to use is uploaded

Rain With Splash
Alright, I am a total noob to AS so here is my problem:

I have some rain that falls and hits an instance of an MC called Pavement. I want it to create and MC called Splash (The name in the library).
Rain: (I already have the moving stuff thanks to a tut!)

Code:
if (hitTest(_root.Pavement)) {
i ++;
duplicateMovieClip(_root.Splash,"Splash" + i,1);
this._alpha = 0;
trace("Hitting");
}
Splash:

Code:
this._x = _root.Rain._x;
this._y = _root.Rain._y;
trace("Created");
Thanks a ton,

Can't See Rain Code
hello all, I'm very new to this whole actionscript thing and was hoping someone could help me out. I have this Rain code that I'm trying to insert in my movie but it won't play at all. I can see it by itself but when I try putting it with other actionscript code it won't do anything. Is there a way to get this code to play in the foreground over everything under it? Thanks


Code:
function createRain()
{
this.createEmptyMovieClip("rain" + (++this.HL), this.HL).onEnterFrame = function()
{
(this._y += 20) < 400 ? this._x += Math.random() * 4 - 2 : this.removeMovieClip();
};
this._parent.createDrops(this["rain" + this.HL]);
}
function createDrops(t)
{
for (var c = 0; c < 70; c++)
{
t.lineStyle(1, 0xFFFFFF, Math.random() * 10 + 15);
x = Math.random() * 400;
y = Math.random() * 600;
t.moveTo(x, y);
t.lineTo(x + Math.random() * 4 - 2, y + 25);
}
}

this.createEmptyMovieClip("rain", ++this.HL);
this.rain.onEnterFrame = createRain;

Random Rain
On a couple of peoples footers, I've seen that random rain effect, is it possible without much as? (does anyone know what i'm even talking about?)

Rain Effect Help?
Hello, I'm looking for some help on creating a rain effect a website I'm developing.

I've seen tutorials on how to create a rain effect, except for one problem: they all add "splashes" at the bottom, to resemble what would happen if a rain drop would hit an object on the ground (water, pavement, etc). I need the effect to travel downward and to the right diagonally, and go completely from the top of the screen, to a point past the bottom where it would no longer be visable. In short, I need the rain drops to travel diagonally from top to bottom without interuption.

I've tried using the blur timeline effect to acomplish this, but to no avail. As I am still new to Flash, I really have no other ideas on how to accomplish this, maybe with a random math function like the one used in the "Snow 2.0" tutorial on this site?

Any help would be greatly appriciated and I would like to thank you in advance for any help and/or consideration any of you give to my plea.

Rain Effect
how can i make some "rain" effect???
sorry, dont speak english very well !
thankyou

RAIN Script?
I would like to make it rain... is it a good script for that?
thanks

Matrix Rain
Hey, i was hoping that somone would be able to help me with how to go about making a matrix rain effect. I wanted to make it in to a screensaver with MDM zinc, but i can't figure out how to make the text rain down and randomly pick letters while falling and having the letters at the end of the trail fade out. . I am trying to go with somthing similar to that, but i am going to use all western lettering, and i don't need some of the trails to be faded or in the back. I just need the letters to be falling right next to each other at random rates and have some be longer then others randomly. If any one has any idea about how to go about this please let me know.

Creating ActionScript On The Fly
Can anyone explain why the following script works a treat until it gets to the _root["thumb"+i].onRelease = function () part? Is it because I am trying to create ActionScript on the fly? I am trying to load in a set of thumbnails and give them button actions using myClip.onRelease. This is the first time I have used the new MX syntax so could someone explain my ignorance.

//this is my test to show that it does work
myClip.onRelease = function(){
trace ("hello");
}

for (i=1;i<9;i++){
xVal += 30;
yVal += 30;
_root.createEmptyMovieClip("thumb" + i,i);
_root["thumb"+i].loadMovie("thumb/" + i + ".jpg",i);
_root["thumb"+i]._x = xVal;
_root["thumb"+i]._y = yVal;
_root["thumb"+i].onRelease = function () {= function () {
trace ("hello");
}
}

WILL The Flash Gods Rain Upon Me.....
the site: http://shiner.net/
(Seems like the whole site is in flash)

1. hit flash, hit popup
2. how in the world did these guys get their whole
album to play with clarity, and to have the load speed
of the complete album play with no problem??
when i put a 1:00 song clip into flash, it takes damn
near a decade to load?
Please give me the solution commandments from your great flash book..

ReDvIaGrA....

Copyright © 2005-08 www.BigResource.com, All rights reserved