Actionscript 3 – Up to 512 Particles

Some examples of the particlesHere another particle experiment. I did this years ago in Flash7 and then made some tests with Flash8 using BitmapData, caching and especially the blendmodes.
Now it is the time to do the same thing with the power of Actionscript3. When I did the particle thing in Flash8 I was really happy about my 32fps with 50 particles on the screen. The AS3 version looks very smooth (was to lazy for a fps counter) and has about 256 particles on the screen.

The speed is proportional to the size of every particle. Using particles with the size of 128×128 px slows flash down and about 100 particles are enough on the screen. I tested this with 16×16 px small particles and increased the amount of particles to 1024 which seemd to be fast.

Don’t forget this also features runtime bitmap manipulation because every particle is only a black/white-texture. For your own testing pleasure and to have more example codes on the web I uploaded the sourcecodes.

Edit:
Set quality to low to get more speed but same look :-)
Another Version with 1600 Particles has been added to the links.

Related Posts

7 Responses to “Actionscript 3 – Up to 512 Particles”


  1. 1 Jeedee

    Mmm it doesnt seem to work. I get a blue background and nothings happen … (Flash8, OSX)

  2. 2 tomsamson

    yeah,that´s because you need flash 8.5 player which comes with flex builder 2

    to joa: sweet stuff mate,looks delicious :)
    funny that turning quality to low helps with performance some more though the look stays the same :)

  3. 3 joa

    Hehe, that’s sweet. The look doesn’t change because the output is a bitmap.

  4. 4 tomsamson

    yeah, i know its bitmapstuff of course but if anti aliasing is causing an addtional slowdown in high quality stting why doesn´t one see any anti aliasing applied? :) i´d expect to at least see a small difference in look (comparing high quality/low quality setting) at the edges when two particles are close to each other, but no difference at all visible there.
    anyway,really dig it :)

  5. 5 tomsamson

    oh, now i see, i should have checked the source before wondering ;)
    you´re drawing all in one bmpdata,then you´d only see the anti aliasing at the edges of its conainer if at all :)
    well,let´s say i was slow because its late here and i´m tired ;)

  6. 6 Ralph

    What’s the deal with using left shift or right shift to store certain numbers? I’m probably guessing it’s for optimizing the code but how and where would you even know where to place such numbers. I’m sure I’m asking a vague question but I”m just wondering if you can shed some light on the subject.

  7. 7 treser

    your source code link is broken

Leave a Reply