# Help: e.target.name traces wrong name?

**URL:** https://forum.kirupa.com/t/help-e-target-name-traces-wrong-name/281342
**Category:** Uncategorized
**Created:** [February 7, 2009, 11:42pm UTC](https://forum.kirupa.com/t/help-e-target-name-traces-wrong-name/281342 "2009-02-07T23:42:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Theofiel](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@Theofiel](https://forum.kirupa.com/u/Theofiel)
#### Post date: [February 7, 2009, 11:42pm UTC](https://forum.kirupa.com/t/help-e-target-name-traces-wrong-name/281342/1 "2009-02-07T23:42:16Z")

</div>

Dear all,

I place several empty movieclips dynamically on the main stage and load a picture in there with a adress derived from a xml file and some text also from the xml file. Then I add a event listner to the movieclip. On stage the image + text is correctly shown, but when I click the image it traces the name of image and not the name of the movieclip in which it is placed, I need the name of the movieclip because i want to tween the movieclip after it is clicked.

```auto

function LoadXML(e:Event):void {
    xmlData = new XML(e.target.data);
    var lijst:XMLList = xmlData.snipper;
    aantal = lijst.length();
    for(var i:Number = 0; i<aantal;i++){
        container = new Container();
        container.name = "snipper"+ i;
        container.addEventListener(MouseEvent.CLICK, onClick);
        container.buttonMode = true;
        container.Tekst.text = lijst*.@snippertekst;
        var l:Loader = new Loader();
        l.load(new URLRequest(lijst*.@image));
        l.x=0;
        l.y=-40;
        container.addChild(l);
        addChild(container);
    }
}

function onClick(e:MouseEvent):void{
    trace(e.target.name);
}    

```

Thaxs a bunch
