Help me please!

How come the remove child comes up with an error in one place but doesnt in another. ive tried rearranging functions and varibale instances but nothing seems to fix it. Heres the code


package {
    //
    import flash.display.*;
    import flash.events.*;
    import flash.utils.Timer;
    //
    public class InfectedScripting extends MovieClip {
        //
        public var iGun:MovieClip = new MovieClip();
        private var iBulletSpeed:Number = 65;
        private var bulnum:int = 1;
        private var bulletOffset:Number = 0;
        private var bulletLifeTimerTotal:Number = 100;
        private var reloadSpeed:Number = 50;
        ////////////////////////
        public var myTimer:Timer = new Timer(1, reloadSpeed);
        private var reloadComplete:Boolean = true;
        private var bulletAngle:Number;
        private var randomNum:Number;
        public var spawnX:Number = 0;
        public var spawnY:Number = 0;
        private var rotationDirection:Number;
        private var bulletLifeTimer = 0;
                
        public function InfectedScripting():void {
            iGun = new SCAR_GUN_mc;
            addEventListener(MouseEvent.MOUSE_MOVE, mouseMove_handler);
            addEventListener(MouseEvent.CLICK, doSlug);
            this.addChild(iGun);
            iGun.x = 250;
            iGun.y = 200;
            spawnX = iGun.x;
            spawnY = iGun.y;
            iGun.cacheAsBitmap = true;
        }
        private function mouseMove_handler(e:Event):void {
            var theX:int = mouseX - iGun.x;
            var theY:int = (mouseY - iGun.y) * -1;
            var angle:Number = Math.atan(theY/theX)/(Math.PI/180);
            if (theX<0) {
                angle += 180;
            }
            if (theX>=0 && theY<0) {
                angle += 360;
            }
            iGun.rotation = (angle*-1);
        }
        public function doSlug(e:Event){
            if(reloadComplete == true){
                var    iBullet:MovieClip = new MovieClip();
                iBullet = new iBullet_mc
                iBullet.name = "slug" + bulnum
                bulnum += 1 ;
                addChild(iBullet)
                setChildIndex(iBullet, 0);
                iBullet.rotation = iGun.rotation
                iBullet.x = spawnX;
                iBullet.y = spawnY;
                iBullet.bulletLifeTimer = 0;
                randomNum = ((Math.random()* bulletOffset)-(bulletOffset/2));
                var iBulletAngle = ((iGun.rotation+randomNum) * Math.PI/180);
                iBullet.xSpeed = Math.cos(iBulletAngle) * iBulletSpeed;
                iBullet.ySpeed = Math.sin(iBulletAngle) * iBulletSpeed;
                iBullet.addEventListener("enterFrame", slugz_handler)
                myTimer.addEventListener(TimerEvent.TIMER, myFunction);
**                    //FOR SOME REASON I PUT IT HERE IT WORKS**
                function slugz_handler(enterFrame:Event){
                    iBullet.x += iBullet.xSpeed;
                    iBullet.y += iBullet.ySpeed;
                    if (iBullet.bulletLifeTimer>=bulletLifeTimerTotal) {
                        **//REMOVE CHILD SHOULD GO HERE BUT IT DOESNT WORK**
                        removeChild(iBullet);
                        trace("finaly");
                    }
                    iBullet.bulletLifeTimer += 1;
                }
                startReloading();
            }
        }
        private function myFunction(event:TimerEvent):void {
        myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, gunReloaded)
        }
        private function startReloading(){
            reloadComplete = false;
            myTimer.start();
        }
        private function gunReloaded(e:TimerEvent){
            reloadComplete = true;
            myTimer.reset();
        }
    }
}

The error i get is:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at MethodInfo-3()

I have absoulutely no idea what i did wrong