# Add particles per second (ENTER\_FRAME)

**URL:** <https://forum.kirupa.com/t/add-particles-per-second-enter-frame/316147>\
**Category:** flash\
**Created:** [November 14, 2010, 8:56am UTC](https://forum.kirupa.com/t/add-particles-per-second-enter-frame/316147 "2010-11-14T08:56:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esseti](https://avatars.discourse-cdn.com/v4/letter/e/bb73d2/32.png) [@Esseti](https://forum.kirupa.com/u/Esseti)\
**Post date:** [November 14, 2010, 8:56am UTC](https://forum.kirupa.com/t/add-particles-per-second-enter-frame/316147/1 "2010-11-14T08:56:29Z")

</div>

How can I rig up an if statement that will add particles to the stage based on the ENTER\_FRAME update interval?

```auto

stage.frameRate = 60;

var currentParticles:uint = 0;
var maxParticles:uint = 1000;
var particlesPerSecond:uint = 100;

addEventListener(Event.ENTER_FRAME, addParticle);

function addParticles(e:Event):void {
if (currentParticles<maxParticles && ?) { // <-- what to put here?
trace(currentParticles);
currentParticles++
}
};

```

I run into the problem, where if I choose a bigger value for particlesPerSecond than the stage framerate, I don’t add the correct number of particles.

Please help.
