Real snow effect in flash
by Bence Kucsan 1 year, 8 months ago on Nov 28, 2006 - Commentary (5) - Filed under - Tutorials - Grab the RSS


If you work in/for the commercial sector, you probably have heard these words
"We need some flash ad but this time with some xmas feeling, you know
snow, deers and maybe Santa too... Ah and it's done in an hour, I hope!"



Well, you can put a smile on your face, just as I did, when I found a great tutorial and modified it to make a nice snow falling effect, just like this:


To easily recreate this as step one make a movie with a white small bubble, then as step two attach this few lines of ActionScript:

amount = 100;
mWidth = Stage.width;
mHeight = Stage.height;
for (var i = 0; i thisFlake = this.attachMovie("flake", "flake"+i, i);
with (thisFlake) {
_x = Math.random()*mWidth;
_y = Math.random()*mHeight;
_xscale = _yscale=_alpha=40+Math.random()*60;
}
thisFlake.yspeed = Math.random()*2+.2;
thisFlake.increment = -0.025+Math.random()*0.05;
thisFlake.radian = 0; //declare for actionscript 2.0
thisFlake.onEnterFrame = function() {
this.radians += this.increment;
//trace(this.radians);
this._x += Math.sin(this.radians);
this._y += this.yspeed;
if (this._y>=mHeight) {
this._y = -10;
this._x = -10+Math.random()*mWidth;
}
if (this._x>=mWidth || this._x<=0) {
this._y = -10;
this._x = -10+Math.random()*mWidth;
}
};
}

You can simply modify the amount of the white snow bubbles editing the first “amount=100” line.



by Bence Kucsan 1 year, 8 months ago on Nov 28, 2006 - Commentary (5) - Filed under - Tutorials - Grab the RSS
 
5 Comments  ↓  Last 3 months, 3 weeks ago + Add
 
Bence 
5 comments, add yours!

Your thoughts are welcome!
Make your voice heard, fill out the comment form below and don't be shy to hit that big blue button.

 
on July 12, 2007 at 22:00

Sweet tutorial. I should really download Flash again :(

by 1 year ago - Permalink - Add a Response
Eddy 
on December 21, 2007 at 15:57

Hi, very nice snow
but i think you forgot something on the code;
here is the updated one

Thanks

amount = 100;
mWidth = Stage.width;
mHeight = Stage.height;

for (var i = 0; i <= amount; i++) { // you miss out this part =}

thisFlake = this.attachMovie("flake", “flake"+i, i);
with (thisFlake) {
_x = Math.random()*mWidth;
_y = Math.random()*mHeight;
_xscale = _yscale=_alpha=40+Math.random()*60;
}
thisFlake.yspeed = Math.random()*2+.8;
thisFlake.increment = -0.025+Math.random()*0.05;
thisFlake.radian = 0; //declare for actionscript 2.0
thisFlake.onEnterFrame = function() {
this.radians += this.increment;
//trace(this.radians);
this._x += Math.sin(this.radians);
this._y += this.yspeed;
if (this._y>=mHeight) {
this._y = -10;
this._x = -10+Math.random()*mWidth;
}
if (this._x>=mWidth || this._x<=0) {
this._y = -10;
this._x = -10+Math.random()*mWidth;
}
}
}

by Eddy 7 months, 2 weeks ago - Permalink - Add a Response
Jason Reed 
on March 24, 2008 at 22:22

coolerman intermatch subchloride parahormone overreliant discoactine twanky cordwain
<a href= http://www.cbc.ca/business/ >CBC Business News</a>
http://www.danielslakelodge.com/

by Jason Reed 4 months, 2 weeks ago - Permalink - Add a Response
Alex 
on April 11, 2008 at 23:34

Hi! I’ve read this post - and I think you really smart in AS. Please visit my flash menu builder
Is it OK? I’m working on it all my time. And sometimes there’re really hard coding :)

by Alex 3 months, 4 weeks ago - Permalink - Add a Response
Toney Gillespie 
on April 17, 2008 at 15:15

coolerman intermatch subchloride parahormone overreliant discoactine twanky cordwain
<a href= http://www.northwestern.edu/lutheran/ >University Lutheran Church at Northwestern</a>
http://members.tripod.com/~SAPBTC/rescues.htm

by Toney Gillespie 3 months, 3 weeks ago - Permalink - Add a Response
 
 
 
Leave a Comment
Make your voice heard, fill out the comment form below and don't be shy to hit that big blue button.


Comment                                                                                                                                              *required
Name                                                              *required

E-Mail Address

Website URL

Personal Options
 Remember my personal information

 Notify me of follow up comments

Nothing to say?
No problem, just give stars like they were cookies
Rate Entry
from 2596 readers

I'm not a fan of any form of moderation, but off-topic, offensive comments may be deleted, repeat offenders are playing with a lifetime ban from commenting. Thanks for helping me making this a cool place to be.