# Help! i need get the correct \[ i \] id on click

**URL:** <https://forum.kirupa.com/t/help-i-need-get-the-correct-i-id-on-click/295930>\
**Category:** flash\
**Created:** [September 7, 2009, 3:46pm UTC](https://forum.kirupa.com/t/help-i-need-get-the-correct-i-id-on-click/295930 "2009-09-07T15:46:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lars92](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@lars92](https://forum.kirupa.com/u/lars92)\
**Post date:** [September 7, 2009, 3:46pm UTC](https://forum.kirupa.com/t/help-i-need-get-the-correct-i-id-on-click/295930/1 "2009-09-07T15:46:54Z")

</div>

Hello I’m translating a script AS2 to AS3 … I’m actually rebuilding because I noticed that it is almost impossible to translate hehe …

I need to just get the ID \* of a MC duplicated, only this…  
My structure is like this:

XML:

```auto

<?xml version="1.0" encoding="utf-8"?>
<conteudo>
<nomes>
<img>http://tutorial.thiagobueno.net/t/img/01.jpg</img>
<nome>Kristen Anne Bell</nome>
<idade>28 anos</idade>
<nasc>Huntington Woods</nasc>
</nomes>
<nomes>
<img>http://tutorial.thiagobueno.net/t/img/02.jpg</img>
<nome>Kristin Laura Kreuk</nome>
<idade>26 anos</idade>
<nasc>Vancouver</nasc>
</nomes>
<nomes>
<img>http://tutorial.thiagobueno.net/t/img/03.jpg</img>
<nome>Allison Mack</nome>
<idade>26 anos</idade>
<nasc>Preetz</nasc>
</nomes>
<nomes>
<img>http://tutorial.thiagobueno.net/t/img/04.jpg</img>
<nome>Jessica Schram</nome>
<idade>23 anos</idade>
<nasc>Skokie</nasc>
</nomes>
<nomes>
<img>http://tutorial.thiagobueno.net/t/img/01.jpg</img>
<nome>Kristen Anne Bell</nome>
<idade>28 anos</idade>
<nasc>Huntington Woods</nasc>
</nomes>
<nomes>
<img>http://tutorial.thiagobueno.net/t/img/02.jpg</img>
<nome>Kristin Laura Kreuk</nome>
<idade>26 anos</idade>
<nasc>Vancouver</nasc>
</nomes>
<nomes>
<img>http://tutorial.thiagobueno.net/t/img/03.jpg</img>
<nome>Allison Mack</nome>
<idade>26 anos</idade>
<nasc>Preetz</nasc>
</nomes>
<nomes>
<img>http://tutorial.thiagobueno.net/t/img/04.jpg</img>
<nome>Jessica Schram</nome>
<idade>23 anos</idade>
<nasc>Skokie</nasc>
</nomes>
</conteudo>

```

and my AS:

```auto

var total:Number;
var xml:XML = new XML();
var loadXML:URLLoader = new URLLoader();
 
loadXML.load(new URLRequest("xml.xml"));
loadXML.addEventListener(Event.COMPLETE, lista);
 
function lista(event:Event) {
xml = new XML(event.target.data);
total = xml.nomes.length();
for (var i=0; i<total; i++) {
var MC:MovieClip = new mc();
var loadIMG:Loader = new Loader();
addChild(MC);
MC.y = MC.height*i+MC.y;
MC.nome_txt.text = xml.nomes.nome*;
MC.idade_txt.text = xml.nomes.idade*;
MC.nasc_txt.text = xml.nomes.nasc*;
MC.btn.addEventListener(MouseEvent.CLICK, identifica);
 
trace(MC+i); // <-- here on output sohws 0 to 7
 
//But here when i click show on output only the nunber 7, I would like to show the item Number X when i click on button number X
function identifica(e:MouseEvent):void
{
  trace (MC+i);
}
}
}
 

```

When I give a trace it lists my xml 0 -\> 7, but when I click in a btn with the function trace it only shows the nunber 7, independent which button I click …

Please Help me :hugegrin:
