nf = 50;//number of flakes
mw = 500;
mh = 300;

addSnow = function () {
	for (i=0; i<nf; i++) {
		_root.attachMovie("snow", "snow"+i, i+1);
		//sf is easier to type than "_root["snow"+i]"
		sf = _root["snow"+i];
		sf._x = -10+Math.random()*mw;
		sf._y = -10+Math.random()*mh; 
		sf.xSpeed = (Math.random()*3)+1;
		sf.ySpeed = (Math.random()*3)+1;
		sf.rad = 0;
	}
};

moveSnow = function () {
	for (i=0; i<nf; i++) {
		//sf is easier to type than "_root["snow"+i]"
		sf = _root["snow"+i]
		sf.rad += (sf.xSpeed/180)*Math.PI;//converts the xSpeed into radians
		sf._x += Math.cos(sf.rad);//uses cosine (Trigonometry) for left to right movement
		sf._y += sf.ySpeed;
		//if it reaches the bottom of the screen, go to the top of the screen
		if(sf._y >= mh){
			sf._x = -10+Math.random()*mw;
			sf._y = -10; 
		}
		//if it goes off the side of the screen, go to top and pick a random x position
		if ((sf._x < 0) || (sf._x > mw)) {
		sf._x = -10+Math.random()*mw;
		sf._y = -10;
	}
}
}
addSnow();
onEnterFrame = function () {
	moveSnow();
}