Flash CS3 - Flash particle effect







Download FlashParticlesCS3.zip (6 KB)



ActionScript Code:

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

Anonymous said…
I have added your blog in my favorite list and I am gonna visit it regularly so please update your blog.
flash website developer

Popular posts from this blog

Simple Flash Analog Clock - AS3

Flash CS4 - 3D Rotating Menu

AS3 - Access objects from external SWF files