ENTER_FRAME only executes once and not every frame
I have an ENTER_FRAME event which is supossed to run every frame but it just runs when an if statement is true and only once and not every single frame.
- public function update(e:Event):void
- {
- if(canFire == true)
- {
- trace("The two statements are true");
- var newBullet:Bullet;
- newBullet = new Bullet(gadjet.x, gadjet.y);
- bulletsArray.push(newBullet);
- mcGameStage.addChild(newBullet);
- newBullet.firebullet(); /* as long as this function is executing inside an enter frame's event
- it will make the bullet look moving */
- // this is the Bullet's class firebullet() function
- /*public function firebullet():void
- {
- x = x + 5; // this makes the bullet look moving when using an ENTER_FRAME event
- }*/
- }
- }
Entire class at pastebin:
[ActionScript 3] AvoiderGame4 - Pastebin.com
