BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   How to ? (http://bzupages.com/307-how/)
-   -   how to create Falling Snow animation in flash (http://bzupages.com/f307/how-create-falling-snow-animation-flash-1636/)

.BZU. 26-12-2008 05:31 AM

how to create Falling Snow animation in flash
 
4 Attachment(s)
See this simple and quickly flash 8 action script lesson and learn how to create falling snow animation in flash. You can use this animation for any holidays header, banner, Christmas card... Using this lesson, you will also learn how to convert any object into a Movie Clip Symbol, how to apply action script code on it using the action script panel and much more!


Step 1

Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the dimensions of your document as whatever you like. Choose some kind of a dark color as background color. Set your Flash movie's frame rate to 27 and click ok.


Step 2

Take now the Oval Tool (O). In the Colors portion of the Tool panel, block the Stroke color by clicking on the little pencil icon and then on the small square with the red diagonal line. For Fill color choose white color and draw a "circle" about 4x4 px.


Step 3

While the circle is still selected, press F8 key (Convert to Symbol) to convert this circle into a Movie Clip Symbol.


Step 4

While the new made Movie Clip (circle) is still selected, go to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this Movie Clip "snow". See the picture below!


Step 5

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:
Code:

onClipEvent (load) {
 movieWidth = 350;
 movieHeight = 263;
 
 i = 1+Math.random()*2;
 k = -Math.PI+Math.random()*Math.PI;
 
 this._xscale = this._yscale=50+Math.random()*100;
 this._alpha = 75+Math.random()*100;
 this._x = -10+Math.random()*movieWidth;
 this._y = -10+Math.random()*movieHeight;
}
onClipEvent (enterFrame) {
 rad += (k/180)*Math.PI;
 this._x -= Math.cos(rad);
 this._y += i;
 if (this._y>=movieHeight) {
  this._y = -5;
 }
 if ((this._x>=movieWidth) || (this._x<=0)) {
  this._x = -10+Math.random()*movieWidth;
  this._y = -5;
 }
}

Step 6

Select now the first frame, go again to the Action Script Panel (F9) and enter this code inside the actions panel:

for (k=0; k<50; k++) {
duplicateMovieClip(this.snow, "snow"+k, k);
}

Now, we're done!

Test your Movie and enjoy!


All times are GMT +5. The time now is 12:58 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.