# AS3 Gun Toubles

**URL:** <https://forum.kirupa.com/t/as3-gun-toubles/279461>\
**Category:** programming\
**Created:** [January 14, 2009, 10:32pm UTC](https://forum.kirupa.com/t/as3-gun-toubles/279461 "2009-01-14T22:32:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crucifix](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@crucifix](https://forum.kirupa.com/u/crucifix)\
**Post date:** [January 14, 2009, 10:32pm UTC](https://forum.kirupa.com/t/as3-gun-toubles/279461/1 "2009-01-14T22:32:07Z")

</div>

Hi guys im trying to get a game together in AS3 and i was hoping you could halp me out. im relativley new to as3 but know as2 very well. My problem was that was that i dont know what im doing worng here

```auto
        
private function click_handler(Mousedown:Event){
            var bulnum:int = 1
            var iBulletSpeed:Number = 40;
            var iBullet:MovieClip = this.attachMovie("iBullet_mc","slug"+bulnum, _root.getNextHighestDepth());
            iBullet._x = iGun._x;
            iBullet._y = iGun._y;
            var randomNum:int = random(4)-(4/2);
            var iBulletAngle:Number = ((iGun._rotation+randomNum-90)*Math.PI/180);
            iBullet.xSpeed = Math.cos(iBulletAngle)*iBulletSpeed;
            iBullet.ySpeed = Math.sin(iBulletAngle)*iBulletSpeed;
            bulnum +=1
        }

```

Then i would have the rest of the bullet stuff in something else but i can handle that but when i debug this i get these errors

1061: Call to a possibly undefined method attachMovie through a reference with static type InfectedScripting.  
1120: Access of undefined property \_root.  
1180: Call to a possibly undefined method random.

i know what these are i just dont know how to fix them thx.
