Section 1
//MainTimeline (Particles_fla.MainTimeline)
package Particles_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.printing.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var particleTimer:Timer;
public var particles:Array;
public var mouseIsDown:Boolean;
public function MainTimeline(){
addFrameScript(0, frame1);
}
public function randRange(_arg1:Number, _arg2:Number){
return (((Math.random() * (_arg2 - _arg1)) + _arg1));
}
public function startMagic(_arg1:MouseEvent){
mouseIsDown = true;
}
function frame1(){
mouseIsDown = false;
particles = new Array();
particleTimer = new Timer(5);
Mouse.hide();
particleTimer.start();
stage.addEventListener(MouseEvent.MOUSE_DOWN, startMagic);
stage.addEventListener(MouseEvent.MOUSE_UP, finishMagic);
particleTimer.addEventListener(TimerEvent.TIMER, frameLoop);
}
public function frameLoop(_arg1:TimerEvent){
var _local2:Particle;
var _local3:int;
_local3 = 0;
while (_local3 < particles.length) {
particles[_local3].update();
_local3++;
};
if (mouseIsDown){
_local2 = new Particle(Spark, this, mouseX, mouseY);
_local2.xVel = randRange(-3, -3.1);
_local2.yVel = randRange(-5, -5.2);
_local2.drag = 0.99;
_local2.gravity = 0.08;
_local2.clip.scaleX = (_local2.clip.scaleY = randRange(0.2, 1));
_local2.shrink = 0.99;
_local2.fade = 0.001;
particles.push(_local2);
};
while (particles.length > 200) {
_local2 = particles.shift();
_local2.destroy();
};
}
public function finishMagic(_arg1:MouseEvent){
mouseIsDown = false;
}
}
}//package Particles_fla
Section 2
//Particle (Particle)
package {
import flash.display.*;
public class Particle {
public var fade:Number;// = 0
public var yVel:Number;// = 0
public var xVel:Number;// = 0
public var shrink:Number;// = 1
public var gravity:Number;// = 0
public var clip:DisplayObject;
public var drag:Number;// = 1
public function Particle(_arg1:Class, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number){
xVel = 0;
yVel = 0;
drag = 1;
gravity = 0;
shrink = 1;
fade = 0;
super();
clip = new (_arg1);
_arg2.addChild(clip);
clip.x = _arg3;
clip.y = _arg4;
}
public function update():void{
clip.x = (clip.x + xVel);
clip.y = (clip.y + yVel);
xVel = (xVel * drag);
yVel = (yVel * drag);
yVel = (yVel + gravity);
clip.scaleX = (clip.scaleX * shrink);
clip.scaleY = (clip.scaleY * shrink);
clip.alpha = (clip.alpha - fade);
}
public function destroy():void{
clip.parent.removeChild(clip);
}
}
}//package
Section 3
//Spark (Spark)
package {
import flash.display.*;
public dynamic class Spark extends MovieClip {
}
}//package