# removeChild problem

**URL:** <https://forum.kirupa.com/t/removechild-problem/263429>\
**Category:** Uncategorized\
**Created:** [June 16, 2008, 2:12am UTC](https://forum.kirupa.com/t/removechild-problem/263429 "2008-06-16T02:12:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![reblis](https://avatars.discourse-cdn.com/v4/letter/r/b19c9b/32.png) [@reblis](https://forum.kirupa.com/u/reblis)\
**Post date:** [June 16, 2008, 2:12am UTC](https://forum.kirupa.com/t/removechild-problem/263429/1 "2008-06-16T02:12:33Z")

</div>

I’m trying to remove a linked MC once it reaches a certain point on the stage, but it seems to remove all the MC’s. How do I single out just the specific one that is at that stage position?

Here is my code:

```auto

package
{
    import flash.display.MovieClip;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import caurina.transitions.*;
    
    public class DocumentClass extends MovieClip
    {
        private var timer:Timer = new Timer(100);
        
        public function DocumentClass():void
        {
            timer.addEventListener(TimerEvent.TIMER, makeStar);
            timer.start();
        }
        
        private function makeStar(e:TimerEvent):void
        {
            var star:Star = new Star();
            star.scaleX = star.scaleY = Math.random();
            star.x = Math.random() * this.stage.stageWidth
            star.y = 400;
            Tweener.addTween(star, {y:-20,time:5, transition:"easeoutExpo"});
            this.addChild(star);
            
            if(star.y >= 10)
            {
                trace("this is working");
                /*this.removeChild(star);*/
            }
            
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![reblis](https://avatars.discourse-cdn.com/v4/letter/r/b19c9b/32.png) [@reblis](https://forum.kirupa.com/u/reblis)\
**Post date:** [June 17, 2008, 4:00am UTC](https://forum.kirupa.com/t/removechild-problem/263429/2 "2008-06-17T04:00:52Z")

</div>

maybe I wasn’t clear in my code or my explanation.

When the stars reach a certain height I want them to be removed from the stage.  
I set this to y=10 for this so you can see them, in the final movie they will be removed once they are at some point off stage.

```auto

package
{
    import flash.display.MovieClip;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import caurina.transitions.*;
    
    public class DocumentClass extends MovieClip
    {
        private var timer:Timer = new Timer(100);
        
        public function DocumentClass():void
        {
            timer.addEventListener(TimerEvent.TIMER, makeStar);
            timer.start();
        }
        
        private function makeStar(e:TimerEvent):void
        {
            var star:Star = new Star();
            star.scaleX = star.scaleY = Math.random();
            star.x = Math.random() * this.stage.stageWidth
            star.y = 400;
            Tweener.addTween(star, {y:20,time:5, transition:"easeoutExpo"});
            this.addChild(star);    
        }
    }
}

```

I need to to remove just one instance the specific star that is at that point not all of them.

Any extra insight would be appreciated.

~reblis
