# Using for loop to set function names from an array

**URL:** <https://forum.kirupa.com/t/using-for-loop-to-set-function-names-from-an-array/284030>\
**Category:** Uncategorized\
**Created:** [March 13, 2009, 10:25pm UTC](https://forum.kirupa.com/t/using-for-loop-to-set-function-names-from-an-array/284030 "2009-03-13T22:25:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![count\_schemula](https://avatars.discourse-cdn.com/v4/letter/c/90ced4/32.png) [@count\_schemula](https://forum.kirupa.com/u/count_schemula)\
**Post date:** [March 13, 2009, 10:25pm UTC](https://forum.kirupa.com/t/using-for-loop-to-set-function-names-from-an-array/284030/1 "2009-03-13T22:25:22Z")

</div>

// array with function name parts  
var functionNames:Array = [“something1”,“something2”,“something3”];

// create functions looping through array  
for (var i:Number = 0; i \<= functionNames.length; i++){  
var funcName1:String = “prefix\_”+functionName\*+“_suffix";  
function funcName1(evt:MouseEvent){  
// important things with Demetri Martin  
}  
var funcName2:String = "prefix_”+functionName\*+"\_othersuffix";  
function funcName2(evt:MouseEvent){  
// important things with Demetri Martin  
}  
}

I’ve tried some various things (including “this”), but basically, I need to loop through data held in arrays to create several dynamically named functions on the the fly.
