All pastes #405121 Raw Edit

ParticleSystem.as

public text v1 · immutable
·published 2007-03-21 14:52 UTC
rendered paste body
package{
	
	import flash.display.Sprite;
	import flash.display.DisplayObject;
	import flash.events.*;
	
	public class ParticleSystem extends Sprite{
		
		var particles:Array;
		
		function ParticleSystem(num:uint, rad:int, colo:uint = 0x000000) {
			particles = new Array();
			for(var n:uint; n < num; n++){
				particles.push(new Particle(rad, colo));
			}
			addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
		}
		
		function onAddedToStage(evt:Event){
			for(part in particles){
				addChild(part);
			}
		}
		
		function draw(alpha:Number = 1.0) {
			for(part in particles){
				part.draw();
			}
		}
	}
}