# Functions and arrays

**URL:** <https://forum.kirupa.com/t/functions-and-arrays/203763>\
**Category:** Uncategorized\
**Created:** [October 13, 2006, 8:10pm UTC](https://forum.kirupa.com/t/functions-and-arrays/203763 "2006-10-13T20:10:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhryn](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@Dhryn](https://forum.kirupa.com/u/Dhryn)\
**Post date:** [October 13, 2006, 8:10pm UTC](https://forum.kirupa.com/t/functions-and-arrays/203763/1 "2006-10-13T20:10:02Z")

</div>

I am trying to run different functions from the values taken from an array. This is part of a game so that enemies can have different moves, and dirrections.

I was trying to use the script:  
arrayName = [“value1”,“value2”,value3"];

value1 = function(){  
//code here  
};

value2 = function(){  
//code here  
};

value3 = fucntion(){  
//code here  
};

arrayNamerandom(2);

But this doesnt do anything, dont think flash allows variables to be used to run functions.

If any one knows how I can do this with out a list of if commands, I want to be able to use a long array.

thank you
