# Variables for function names

**URL:** <https://forum.kirupa.com/t/variables-for-function-names/37635>\
**Category:** flash\
**Created:** [December 12, 2003, 12:03pm UTC](https://forum.kirupa.com/t/variables-for-function-names/37635 "2003-12-12T12:03:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carixpig](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/carixpig/32/304_2.png) [@Carixpig](https://forum.kirupa.com/u/Carixpig)\
**Post date:** [December 12, 2003, 12:03pm UTC](https://forum.kirupa.com/t/variables-for-function-names/37635/1 "2003-12-12T12:03:37Z")

</div>

Good day,

Here is the project I’ve been working on:  
[http://www.margaretsplace.com.au/Assets/mda.html](http://www.margaretsplace.com.au/Assets/mda.html)

Currently, it’s overly big because my scripting is verbose and cumbersome.

I’ve created an array to hold 8 function names:

[AS]  
\_global.swatchFunction = [“dropAUL”, “dropAUR”, “dropALL”, “dropALR”, “dropBUL”, “dropBUR”, “dropBLL”, “dropBLR”]  
[/AS]

I have 8 buttons on the stage. Each button is supposed to change the function so that I can use the same scrolling thumbnail mc to load images into different placeholder mcs.

So I proposed to myself that each button would have:

[AS]  
on(release){  
functionName = swatchFunction[0];  
}  
[/AS]

I’ve created the 8 functions in the first frame, so all I’m trying to do is swap over the function name with the on(release) handler.

Basically, can I use a variable to call a function?

Any suggestions? Direction? Thanks.
