its snowy
// forked from hacker_9h3e713z's forked from: forked from: tes
// forked from hacker_9h3e713z's forked from: tes
// forked from hacker_9h3e713z's tes
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.Event;
public class FlashTest extends MovieClip
{
private var diameter:Number = 0;
private var pCount:Number = 100;
public function FlashTest()
{
var bg:MovieClip = new MovieClip();
bg.graphics.beginFill(0x000000);
bg.graphics.drawRect(-150,-150,800,800);
addChild(bg);
addEventListener(Event.ENTER_FRAME,createParticles);
}
private function createParticles(evt:Event):void
{
var pointer:MovieClip = new MovieClip();
drawCircle(pointer);
pointer.x = Math.random()*500-150;
pointer.y = -200;//-150-Math.random()*150;
pointer.alpha = .2+Math.random()*.75
pointer.wind = -1.5+Math.random()*(1.4*3);
pointer.k = 1+Math.random()*2;
//pointer.x = -150;
//pointer.y = -150;
//pointer.addEventListener(Event.ENTER_FRAME,particleMove);
pointer.addEventListener(Event.ENTER_FRAME,snowFallDown);
addChild(pointer);
}
private function drawCircle(mc:MovieClip):void
{
var d:Number = Math.random()*5;
mc.graphics.lineStyle(0,0x333333,1);
mc.graphics.beginFill(0xFFFFFF);
mc.graphics.drawCircle(150,150,d/2);
}
private function particleMove(evt:Event):void
{
var diffX:Number = (mouseX-150)-evt.target.x;
var diffY:Number = (mouseY-150)-evt.target.y;
evt.target.x += diffX/6;
evt.target.y += diffY/6;
evt.target.alpha -= .05;
if (evt.target.alpha<0)
{
evt.target.parent.removeChild(evt.target);
}
}
private function snowFallDown(evt:Event):void
{
//var diffX:Number = (mouseX-150)-evt.target.x;
//var diffY:Number = (mouseY-150)-evt.target.y;
evt.target.x += evt.target.wind;
evt.target.y += evt.target.k;
//evt.target.alpha -= .05;
if (evt.target.y>350)
{
evt.target.parent.removeChild(evt.target);
}
}
}
}