This tutorial shows you how to create falling snow animation with Flash. This animation can be use for headers, banners, greeting cards...
Step 1: First create a new Flash document and find an image to use as your background, I use this one (300x224 pixels)  Resize your document to fit with your background and set the frame rate to 20 and click OK 
Step 2: Drag and drop your photo onto your document, make sure it lies inside your document 
Step 3: Create a new layer, use the Oval Tool with empty border color and white fill color to draw a small circle 
Step 4: Use the Selection Tool to select it and press F8 to convert it to a movie clip type and name it mc_snow 
Step 5: Press Ctrl-F3 to bring up the Properties box if it is not showed up and name it snow in the Instance name input 
Step 6: Select the Selection Tool (V) and click once on the Movie Clip (circle) to select it. Then, go to the Action Script Panel (F9) and enter this code inside the actions panel: onClipEvent (load) { this._xscale = this._yscale = Math.random() * 40 + 20; this._x = Math.random() * Stage.width; this._y = Math.random() * 200 - 200; this._alpha = Math.random() * 20 + 80; speed = Math.random()*3 + 2; } onClipEvent (enterFrame) { this._y += speed; if (this._y>=Stage.height) { this._y = -5; } } |
The load event will be called when an instance of our movie clip is created. In this event, we resize the instance (through _xscale and _yscale properties), make it smaller than the original one. We also set its initial place (through _x and _y properties, and y <= 0 to make it lie on the top of our document). We set the alpha (transparency)from 80% to 100% and the speed from 2 to 5. The enterFrame event will be called when the flash player enters a frame and it is looped, so we can use it to make animation on our instance: this._y += speed and check if our instance reaches the bottom of the document then its position (y axis) will be reset to -5: this._y = -5 Step 7: Create a new layer and name it action, click on its first frame and press F9 to bring up the Action panel then type in: for (k=0;k<100;k++) { duplicateMovieClip("snow","snow"+k,k); } |
Below is the result when pressing Ctrl-Enter to test: Notice that this code will create 100 instances of the snow (with instance names from snow0, snow1,snow2...,snow99). The last parameter is the depth of the instance.
|