Particle System
I have just started playing around with artistic art in Flash. I started off playing with particles, so here you go. I developed a simple Particle class, and here is how to implement it.
To download the class: http://harry-northover-code-store.googlecode.com/files/Particle.zip
To download the demo: http://harry-northover-code-store.googlecode.com/files/Demo.zip
Here is a screene:
Here’s the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | package { import com.harrynorthover.particle.Particle; import flash.events.Event; import flash.display.Sprite; public class ParticleTest extends Sprite { private var emmiterX:Number = stage.stageWidth / 2; private var emmiterY:Number = stage.stageHeight / 2; public function ParticleTest() { stage.addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true); } private function onLoop(evt:Event) { var p:Particle = new Particle(emmiterX, emmiterY, Math.random() * 11 - 6, Math.random() * -20, 1, Math.random() * 0xFFFFFF, 50, true); addChild(p); } } } |
To get this working, all you need to do is create a MovieClip with a linkage ID of ‘Ball’, and you should be ready to go.
So there you are! If anyone would like me to explain the code, feel free to contact me.
Harry.
