# Removing and adding

**URL:** <https://forum.kirupa.com/t/removing-and-adding/279261>\
**Category:** flash\
**Created:** [January 12, 2009, 1:23pm UTC](https://forum.kirupa.com/t/removing-and-adding/279261 "2009-01-12T13:23:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mitchelvase](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@mitchelvase](https://forum.kirupa.com/u/mitchelvase)\
**Post date:** [January 12, 2009, 1:23pm UTC](https://forum.kirupa.com/t/removing-and-adding/279261/1 "2009-01-12T13:23:56Z")

</div>

Hi there,

I’m new with actionscript 3 and i’m trying to understand how the adding and removing works with objects in as3.

I have this:

```auto
var myArray:Array = [["asdf"],["qwer"],["qwer"]];
for (var i:int=0;i<myArray.length;i++)
{
var myObject:Object= new Object();

myObject["myLabel_"+i] = new Hallo();
myObject["myLabel_"+i].name = +i;
myObject["myLabel_"+i].y = 10 + i * (myObject["myLabel_"+i].height + 10);

addChild(myObject["myLabel_"+i]);

myObject["myLabel_"+i].addEventListener(MouseEvent.CLICK, myData);
}

function myData(event:MouseEvent):void
{
    var string:String = event.currentTarget.name;
    trace(this.parent);
    trace(event.currentTarget.name);
    //this.parent.removeChild(this);
    //removeChild(myObject["myLabel_"+i]);
}

```

But how do i remove the object that is being clicked?  
so if you click on object myObject[“myLabel\_1”] it wil be removed

hope someone can help
