# Help with variables

**URL:** https://forum.kirupa.com/t/help-with-variables/144564
**Category:** Uncategorized
**Created:** [April 15, 2005, 5:49am UTC](https://forum.kirupa.com/t/help-with-variables/144564 "2005-04-15T05:49:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![hiredassassin](https://avatars.discourse-cdn.com/v4/letter/h/ed655f/32.png) [@hiredassassin](https://forum.kirupa.com/u/hiredassassin)
#### Post date: [April 15, 2005, 5:49am UTC](https://forum.kirupa.com/t/help-with-variables/144564/1 "2005-04-15T05:49:30Z")

</div>

Hi all.

Building my first flash site ever, and still struggling…

especially with the easy stuff!

Im buiding a little image gallery type thing, hich has about 100 buttons, all identical, but ive named them differnetly (obviously).

What i want to know is this:

All of these buttons do exactly the same function (load a jpeg), but vary in their name and in the name of the jpeg they load… so rather than writing out the same function 100 times, how can i do this with variables??

i know it must be easy, but my head hurts already, and i just cant get my head round it.

my code:

btnAdv1.onRelease = function(){  
createEmptyMovieClip(“holder”, 100);  
holder.loadMovie(“adv1.jpg”);  
holder.\_x = 0;  
holder.\_y = 0;  
}  
btnAdv2.onRelease = function(){  
createEmptyMovieClip(“holder”, 100);  
holder.loadMovie(“adv2.jpg”);  
holder.\_x = 0;  
holder.\_y = 0;  
}  
etc.etc. - as you can see all that changes is the name of btnAdvX and the image, advX.jpeg

any help would be appreciated
