Script/code
Insert the code under first layer, first frame: for (k=0; k<50; k++) { duplicateMovieClip(_root.snow, "snow"+k, k);
}
Script for object: onClipEvent (load) { //specifies the size of the movie stage movieWidth = 300; movieHeight = 200; //variables that will modify the falling snow i = 1+Math.random()*2; k = -Math.PI+Math.random()*Math.PI; //giving each snowflake unique characteristics 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) { //putting it all together 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; }
}
-------------------------------------------------
Snow2 – 3 layers
Script/code
Insert the code under first layer, first frame:
/**
* Snow Flakes Effect
*
*/
//settings var speed:Number = 2; var wind:Number = -2; var movieWidth:Number = 550; var movieHeight:Number = 400;
createSnow(_root, 100);
function createSnow(container:MovieClip, numberOfFlakes:Number):Void
{
//run a for loop based on numberOfFlakes for (var i = 0; i < numberOfFlakes; i++) { //set temporary variable and attach snowflake to it from the library var tempFlake:MovieClip = container.attachMovie("snow_mc", "snow"+container.getNextHighestDepth(), container.getNextHighestDepth());
//variables that will modify the falling snow tempFlake.r = 1+Math.random()*speed; tempFlake.k = -Math.PI+Math.random()*Math.PI; tempFlake.rad = 0;
//giving each snowflake unique characteristics var randomScale:Number = random(50)+50; tempFlake._xscale = randomScale; tempFlake._yscale = randomScale tempFlake._alpha = random(100)+50;