# onClick, set variable, no function

**URL:** <https://forum.kirupa.com/t/onclick-set-variable-no-function/280186>\
**Category:** flash\
**Created:** [January 23, 2009, 8:55pm UTC](https://forum.kirupa.com/t/onclick-set-variable-no-function/280186 "2009-01-23T20:55:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![justlearning](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@justlearning](https://forum.kirupa.com/u/justlearning)\
**Post date:** [January 23, 2009, 8:55pm UTC](https://forum.kirupa.com/t/onclick-set-variable-no-function/280186/1 "2009-01-23T20:55:30Z")

</div>

Hey everyone. been a trillion years since on the kirupa forums. I’m working with XML and setting up a portfolio gallery. I basically want a thumbnail to be clicked and have an image opening, but i want the instance name of a button that is clicked to be stored in a variable that can be used when calling the images from the XML. this is what i have at the moment.

So i’m just trying to get the number that is in the instance name of btn2, and use that number 2 to reference the ID # in the xml file. i know there are easier ways to do this, but i didnt want to write new functions for all the numerous thumnbails on the site.

```php

btn1. addEventListener(MouseEvent.Click, _onBtnClick);

function _onBtnClick( e:MouseEvent ):void {
    var clickedBtn = event.target.name;
}

```

also the thumbnails are not being loaded through the XML, would it be easier to load the larger images without functuions for each thumb, if i had the thums being referenced through the XML?
