| Creating snow with simple actionscript - Flash Tutorial |
| BELOW IS THE EXAMPLE OF WHAT WE ARE GOING TO CREATE. |
| Open your flash program and set the dimensions. Next import any image to be used as background. In our case we have used a house covered with snow. Name this layer as background or image. |
| Create a new layer and name it text and write any message or jingle. This is optional.If you do not want to write anything then skip this step. Next create a small circular shaped object - white in colour with either circular tool or with brush. Select this shape and convert it to a movieclip. Name it s_fall. In the same window click on the advanced tab and tick the export for actionscript check box ( linkage ) and name the identifier as s_fall. |
| Delete this shape as we do not require it anymore. You can find this movie clip in your library. |
Next create a new layer above the background layer and name it action. Press F9 and add the following action script. |
| width = 400; height = 300; max = 170; for (var m = 0; m != max; m++) { var mc = _root.attachMovie("s_fall", "s_fall"+m, _root.getNextHighestDepth()); mc._x = (Math.random()*(width+20))-10; mc._y = (Math.random()*(height+20))-10; mc.yspeed = (Math.random()*1.75)+0.25; mc.speed = (Math.random()*3)+2; mc._xscale = mc._yscale=(mc.speed+mc.yspeed)*10; mc.onEnterFrame = function() { var angle = Math.atan2(_root._xmouse-(width/2), _root._ymouse)+1.5707963267949; this._y += Math.sin(angle)*this.speed+this.yspeed; this._x += Math.cos(angle)*this.speed; if (this._x>width+10) { this._x = -10; } else if (this._x<0-10) { this._x = width+10; } if (this._y>height+10) { this._y = -10; } else if (this._y<0-10) { this._y = height+10; } }; } |
| Change the height and the width as per your needs. Change the variable max to change the density of snow. Other variables which can be changed are the x-axis and y-axis speed of snow fall. |
![]() |
Test your movie. |
| Hope you have enjoyed this flash tutorial on creating snow with actionscript. |
About Me :
I am a Web designer from Mumbai India. The recent changes
in web design standards has brought in lots of misunderstandings
and misconceptions. The idea behind the web 2.0 standardisation ....read the complete article
Following are the tools / packages and technologies I use for creating
my websites.
Contact Me :
Please contact me for web-design work
Please fill up the form :