# Determining which button was clicked

**URL:** <https://forum.kirupa.com/t/determining-which-button-was-clicked/272665>\
**Category:** flash\
**Created:** [October 7, 2008, 2:31pm UTC](https://forum.kirupa.com/t/determining-which-button-was-clicked/272665 "2008-10-07T14:31:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![a2thek26](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@a2thek26](https://forum.kirupa.com/u/a2thek26)\
**Post date:** [October 7, 2008, 2:31pm UTC](https://forum.kirupa.com/t/determining-which-button-was-clicked/272665/1 "2008-10-07T14:31:29Z")

</div>

I’m making a set of buttons from xml…each button is corresponding with a picture in a photogallery…

```auto

for (var i:Number = 0; i < intSlideCount; i++) {

	var newThumb = this.addChild(new Thumb());
	newThumb.x = X + (SPACE * i);
	newThumb.y = Y;
				
	newThumb.theNum.text = i + 1;
	newThumb.addEventListener(MouseEvent.CLICK, onClick);
}

```

Here is my onClick listener…

```auto

private function onClick(e:MouseEvent):void {
	if(slideTimer.running) {
		slideTimer.stop();
	}
			
	slideLoader = new Loader();
	slideLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fadeSlideIn);
	slideLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
	slideLoader.load(new URLRequest(xmlSlideshow..image[????????].@src));
}

```

i can’t figure out how to get the button to correspond with the correct picture… hence the question marks…please help
