Snow « Nature « Flash Tutorials

Home
Flash Tutorials
1.Actionscript Programming
2.Animals
3.Animation
4.Colors
5.Design
6.Effects
7.Game Cartoon
8.Humans
9.Models
10.Nature
11.Operations
12.Shapes
Photoshop Tutorials
Maya Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
Flash Tutorials » Nature » Snow 

Step 5 Now select your snow flake, open the actions panel, and paste this code: onClipEvent (load) { this._width = 11;// Reset the width, for duplicating purposes; this._height = 11;// Reset the height, for duplicating purposes; var fallSpeed = random(_root.max_speed)*(_root.wind_speed/5);// Just some math for the fall speed var c_speed = _root.wind_speed// The current speed (needed for blizzard winds if (fallSpeed == 0) {// That means it won't move! :S fallSpeed = 1;// Let us move! }// End fall speed // This ONLY WORKS IF YOUR WIDTH AND HEIGHT ARE THE SAME!!! // MAKE SURE THEY ARE OF YOUR SNOW_FLAKE! var snow_width = random(this._width);// Gets the width of the snow_flake this._width = snow_width;// Set the width to the new one this._height = snow_width;// Set the height to the new one fallSpeed = snow_width+random(_root.max_speed);// Make our fall speed } onClipEvent (enterFrame) { this._y += fallSpeed;// Make the snow_flake fall if(c_speed != 0){// If(the current wind speed is not 0 this._x += c_speed// We can stay put on the x axis! }//End c_speed if if(this._y > _root.stage_height+10){// If this is off the stage this.removeMovieClip()// Temove it! }// Done stage check y if(this._x > _root.stage_width+10){// If we're out of the x sight // This allows us to continue to see snow if wind speed is high this._x = -10;// Put us back to beginning (x axis)! (creates a neat effect) }// Done stage check x if(this._x < 0-10){// If we're out of the x sight // This allows us to continue to see snow if wind speed is high this._x = _root.stage_width+10;// Put us back to beginning (x axis)! (creates a neat effect) }// Done stage check x }

C# Introduction

A snow flake is attached using the attachMovie and given the variable thisFlake is assigned as a temporary refrence.

w_w__w__.__ja___v_a__2__s___.__c_o_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.