# Targeting button when you click the button

**URL:** <https://forum.kirupa.com/t/targeting-button-when-you-click-the-button/260617>\
**Category:** Uncategorized\
**Created:** [May 17, 2008, 4:47pm UTC](https://forum.kirupa.com/t/targeting-button-when-you-click-the-button/260617 "2008-05-17T16:47:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobcooper](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@bobcooper](https://forum.kirupa.com/u/bobcooper)\
**Post date:** [May 17, 2008, 4:47pm UTC](https://forum.kirupa.com/t/targeting-button-when-you-click-the-button/260617/1 "2008-05-17T16:47:07Z")

</div>

Hi there,

I have an interesting little problem… I have a number of thumbnail buttons that I am loading images into and I want to be able to load that image larger when you click on it, here is the code so far…

```auto
for(var i =1; i < imageTotal; i++){
       var thumbLoader =new Loader();
       thumbLoader.load(new URLRequest("images/portfolio/thumbs/" + i + ".jpg"));
       portfolioSectionMC["thumbMC" + i].imageHolderMC.addChild(thumbLoader);
            
       portfolioSectionMC["thumbMC" + i].imageNo = i;
            
       portfolioSectionMC["thumbMC" + i].thumbBU.addEventListener(MouseEvent.MOUSE_DOWN, thumbButton);
       function thumbButton(event:MouseEvent):void {
                
       }
}

```

In as2 I would have simply put \_this.\_parent.imageNo = imageNo to get the number of the button however the new way that as3 asigns buttons means that I cannot use this in a button as it is a function separate from the button. Any ideas how I could go about getting the imageNo variable from within the button without coding every single button separately?

Thanks,

Bob
