# removeChild() before addChild()?

**URL:** <https://forum.kirupa.com/t/removechild-before-addchild/283312>\
**Category:** flash\
**Created:** [March 4, 2009, 8:49pm UTC](https://forum.kirupa.com/t/removechild-before-addchild/283312 "2009-03-04T20:49:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpearson311](https://avatars.discourse-cdn.com/v4/letter/j/977dab/32.png) [@jpearson311](https://forum.kirupa.com/u/jpearson311)\
**Post date:** [March 4, 2009, 8:49pm UTC](https://forum.kirupa.com/t/removechild-before-addchild/283312/1 "2009-03-04T20:49:57Z")

</div>

Hi all. I have a flash movie where I’m trying to load movies to the stage from it’s library. I’ve been able to successfully do this, but how can I test if the movie is already on the stage? Right now, I click a button that loads a movie from the library to the stage, but when I click it again, you can see it adding another instance of the movie clip every time I click the button. I’d like it to only add the clip if it’s not already there. Here is my current code:

```auto

needTab_mc.addEventListener(MouseEvent.CLICK, swapTab);

function swapTab(event:MouseEvent):void {
    var currActive = event.target;

    if (currActive == needTab_mc) {

        var need:mcNeed = new mcNeed();
        addChild(need);
        need.x = 41.5;
        need.y = 74.5;

    }

```

Right now, it just keeps adding the movie over and over again or every time I click the needTab\_mc. Thanks!
