# Completely removing a dynamic display object

**URL:** <https://forum.kirupa.com/t/completely-removing-a-dynamic-display-object/310968>\
**Category:** flash\
**Created:** [June 24, 2010, 7:01am UTC](https://forum.kirupa.com/t/completely-removing-a-dynamic-display-object/310968 "2010-06-24T07:01:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![laaptu](https://avatars.discourse-cdn.com/v4/letter/l/76d3ee/32.png) [@laaptu](https://forum.kirupa.com/u/laaptu)\
**Post date:** [June 24, 2010, 7:01am UTC](https://forum.kirupa.com/t/completely-removing-a-dynamic-display-object/310968/1 "2010-06-24T07:01:13Z")

</div>

To remove a dynamic displayObject completely you need  
removeChild or removeChildAt(index)  
remove all the refrences to the displayObject  
nulling the displayObject

But this is my case

```php

//here recto is a MovieClip on stage

//i creat a dynamic display Object named newMc
var newMc:MovieClip =new MovieClip();
newMc.graphics.beginFill(0x000000,1);
newMc.graphics.drawRect(0,0,10,10);
newMc.graphics.endFill();

recto.addChildAt(newMc,1);

//i refrence the newMc using refrenceMc
var referenceMc:MovieClip = recto.getChildAt(1) as MovieClip ;

recto.removeChildAt(1);
refrenceMc =null;

```

I can’t use [COLOR=“Red”]newMc=null.[/COLOR]

I must reference the [COLOR=“Red”]newMc[/COLOR] using other MovieClip.

So by following above procedure I can’t get rid of [COLOR=“Red”]newMc[/COLOR]

as it is still accessible.So is there any way to nullify [COLOR=“Red”]newMc[/COLOR] via refrencing

And one thing again does

```php
refrenceMc = recto.getChildAt(1) as MovieClip;

```

is refrencing newMc or creating a copy of it.

I believe that it is refrencing newMc but I am not sure why nulling [COLOR=“Red”]refrenceMc[/COLOR] has effect on [COLOR=“Red”]newMc[/COLOR]  
I am still searching for solution and if anything comes I will surely let you know.  
Thanks
