Flash CS3 - Flash particle effect
Download FlashParticlesCS3.zip (6 KB)
import fl.transitions.Tween;
import fl.transitions.easing.*;stage.frameRate=30;
var radius:Number=100;
var speed:Number=1;
var degree:Number=0;
stage.addEventListener(MouseEvent.MOUSE_MOVE,createPartcles);
function createPartcles(IN_Event:MouseEvent):void {
var particle:MovieClip = new mc_cirlce();
particle.x=mouseX;
particle.y=mouseY;
addChild(particle);
particleTween(particle);
particle.addEventListener(Event.ENTER_FRAME,removeParticle);
}
function particleTween(particle:MovieClip):void {
degree+=speed;
var myTween:Tween=new Tween(particle,"x",Regular.easeOut,particle.x,particle.x+Math.cos(degree)*radius,2,true);
var myTween2:Tween=new Tween(particle,"y",Regular.easeOut,particle.y,particle.y+Math.sin(degree)*radius,2,true);
var myTween3:Tween=new Tween(particle,"alpha",Regular.easeOut,1,0,2,true);
}
function removeParticle(IN_Event:Event):void {
MovieClip(IN_Event.target).filters=[new BlurFilter(Math.abs(IN_Event.target.width),Math.abs(IN_Event.target.width),1)];
MovieClip(IN_Event.target).width+=.3;
MovieClip(IN_Event.target).height+=.3;
if (IN_Event.target.alpha==0||IN_Event.target.width>30) {
IN_Event.target.removeEventListener(Event.ENTER_FRAME,removeParticle);
removeChild(MovieClip(IN_Event.target));
}
}
Comments
flash website developer