Function timer

Hey guys, just a quick question for a little shmup I’m working on.

I’ve set up a function so that I can spawn an enemy movieclip with a bunch of defined properties, like this:

//Enemy type, Spawn type, Spawn amount, Spawn delay
spawnEnemy(enemiesArray[drone], “singleWave”, 6, 30);

So it spawns my enemy, gives it a formation type, says how many enemies should spawn, and the gives the delay between each spawned enemy. The only thing is I can’t figure out how to set up the delay.

How can I set up a function that will run a certain amount of times every X frames/milliseconds? I know I can just set up a timer variable in an onEnterFrame but I’d rather not do it that way if possible.

Any help is greatly appreciated.

Thanks!

Brendan