Flash CS3 | CS4 - Mouse Trail
Download MouseTrail.zip, 11 KB
// Developed by Anil kumar N D
// anilkumarnd@gmail.com
// ActionScript 3.0
// 27-April-2009
// http://flash-workshop.blogspot.com/package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.StageAlign;
import flash.display.StageScaleMode;public class MouseTrail extends MovieClip {
/**************************************************************************************************
Default constructor
**************************************************************************************************/public function MouseTrail():void {
var uint_NumberOfParticles:uint=30;
stage.frameRate=30;
stage.scaleMode=StageScaleMode.NO_SCALE;
for (var i:uint=0; i<uint_NumberOfParticles; i++) {
var mc_particle:MovieClip=createParticle(((uint_NumberOfParticles-i)/5)+.8);
mc_particle.alpha= 1-(i / uint_NumberOfParticles);
mc_particle.id=i;
mc_particle.addEventListener(Event.ENTER_FRAME,moveparticles);
addChild(mc_particle);
}
}
/**************************************************************************************************
This function is an event handler for mouse click on nextBtn
INPUT:
IN_event - Event
**************************************************************************************************/function moveparticles(IN_Event:Event):void {
IN_Event.target.x += (mouseX-IN_Event.target.x)/IN_Event.target.id;
IN_Event.target.y += (mouseY-IN_Event.target.y)/IN_Event.target.id;
}
/**************************************************************************************************
This function is an event handler for mouse click on nextBtn
INPUT:
num_radius - Number
OUTPUT:
mc_particle - MovieClip
**************************************************************************************************/function createParticle(num_radius:Number):MovieClip {
var mc_particle:MovieClip=new MovieClip ;
mc_particle.graphics.beginFill(0xFF9900,1);
mc_particle.graphics.drawCircle(0,0,num_radius);
mc_particle.graphics.endFill();
return mc_particle;
}
}//End of class
}//End of package
Comments
flash website developer