# AS2: Can I make a variable a function?

**URL:** <https://forum.kirupa.com/t/as2-can-i-make-a-variable-a-function/292694>\
**Category:** flash\
**Created:** [July 17, 2009, 4:36pm UTC](https://forum.kirupa.com/t/as2-can-i-make-a-variable-a-function/292694 "2009-07-17T16:36:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vivacuica](https://avatars.discourse-cdn.com/v4/letter/v/7993a0/32.png) [@vivacuica](https://forum.kirupa.com/u/vivacuica)\
**Post date:** [July 17, 2009, 4:36pm UTC](https://forum.kirupa.com/t/as2-can-i-make-a-variable-a-function/292694/1 "2009-07-17T16:36:22Z")

</div>

Hey guys–

I have a number of functions in my code that I want to be called from a List Component, depending on what the user selects from the list.

I’ve added a number of cities to the list like this:

```auto

combo.addItem({value:"akron",label:"Akron, OH."});
combo.addItem({value:"albany",label:"Albany, NY."});

```

where [COLOR=Blue]value[/COLOR] is a variable.

I’ve set up a listener for the List component that works fine and I can trace [COLOR=Blue]value [COLOR=Black]so I know things are working.

What I’d like to be able to do is, when the user selects the label “Akron, OH.”, the akron() function gets called.

I thought the way to do this was make a generic function called [COLOR=Blue]jumpTo(); [COLOR=Black]and then pass the name of the city to the function like this:

[/COLOR][/COLOR][/COLOR][/COLOR]

```auto

    combo.selectedItem.value = jumpTo;
    jumpTo();

```

I know intellectually this is dumb but I was just grasping at straws.

Any ideas?
