# Clicking to addChild to stage coordinate problem

**URL:** <https://forum.kirupa.com/t/clicking-to-addchild-to-stage-coordinate-problem/287723>\
**Category:** Uncategorized\
**Created:** [May 5, 2009, 5:04pm UTC](https://forum.kirupa.com/t/clicking-to-addchild-to-stage-coordinate-problem/287723 "2009-05-05T17:04:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SonOfChaos](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@SonOfChaos](https://forum.kirupa.com/u/SonOfChaos)\
**Post date:** [May 5, 2009, 5:04pm UTC](https://forum.kirupa.com/t/clicking-to-addchild-to-stage-coordinate-problem/287723/1 "2009-05-05T17:04:25Z")

</div>

Okay, I’m trying to make a game to help myself learn flash, it is a pseudo 1st person shooter where enemies attack you, and you shoot them. Currently I have a function for shooting at the stage/baddies using the code below. This has two problems, one, when I click somewhere it fires their, but when I click a second time, it fires at 0,0 coordinates on the screen, then if I move the mouse and fire, it doesn’t track accurately. I’m just learning so I’m probably making several dumb mistakes, guidance would be appreciated.

```auto

package{
    import flash.display.*;
    import flash.events.*;
    
   public class Gungame{
 
         public var bulArray:Array = new Array();    
 
     public function Gungame(){
        stage.addEventListener(MouseEvent.MOUSE_DOWN, fire)
     }
     public function fire(){
        for(var i:int = 0; i<1; i++){
           bulArray.push(new Bullet());
           var s:Bullet = bulArray*;
           s.locations;
           addChild(s);
           
        }
     }
   }
}

```

Bullet Class

```auto

package{
    import flash.display.*;
    import flash.events.*;
    
    public class Bullet extends MovieClip{
        public function Bullet(){
            trace('I am working');
            
        }
        public function locations(){
            this.x = mouseX;
            this.y = mouseY;
        }
    }
}

```
