# Fire Rate?

**URL:** <https://forum.kirupa.com/t/fire-rate/181989>\
**Category:** Uncategorized\
**Created:** [March 14, 2006, 7:20pm UTC](https://forum.kirupa.com/t/fire-rate/181989 "2006-03-14T19:20:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uli](https://avatars.discourse-cdn.com/v4/letter/u/ccd318/32.png) [@Uli](https://forum.kirupa.com/u/Uli)\
**Post date:** [March 14, 2006, 7:20pm UTC](https://forum.kirupa.com/t/fire-rate/181989/1 "2006-03-14T19:20:52Z")

</div>

Hello,  
I can’t figure out which way to go to have a good firing from a weapon with a rate of fire…  
I have a hero class where i have, inside an onEnterFrame function :

```auto

if (Key.isDown(Key.SPACE) && fireInterval == false) {
			var myInt = setInterval(this.launchMissile(), this.missileRate);
			fireInterval = true;
		}
		if (!Key.isDown(Key.SPACE)) {
			clearInterval(myInt);
			fireInterval = false;
		}

```

the launchMissile function is a simple attachMovie function.  
Now for some reason, even if i hold the space key down, the interval isn’t working… Help 😃
