# Function call from array entry

**URL:** <https://forum.kirupa.com/t/function-call-from-array-entry/206037>\
**Category:** flash\
**Created:** [November 4, 2006, 11:30am UTC](https://forum.kirupa.com/t/function-call-from-array-entry/206037 "2006-11-04T11:30:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![coop](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@coop](https://forum.kirupa.com/u/coop)\
**Post date:** [November 4, 2006, 11:30am UTC](https://forum.kirupa.com/t/function-call-from-array-entry/206037/1 "2006-11-04T11:30:29Z")

</div>

Hi all,

Is it possible to call a function from an array entry. I’m attaching MC’s using a loop and an array for the names of the MC’c (which are used as btn’s), and then a seperate array to try and give the MC’s onRelease functions.?  
The trace works but the functions don’t

[AS]  
content\_arr = [“one”, “two”, “three”];  
action\_arr = [funOne(), funTwo(), funThree()];  
for (var n = 0; n\<content\_arr.length; n++) {  
contentBtn = holder\_mc.attachMovie(“btn\_mc”, “btn\_mc”+n, n+1);  
contentBtn.wName\_txt.text = content\_arr[n];  
contentBtn.\_x = (n%3)\*80;  
contentBtn.toDo = action\_arr[n];  
contentBtn.onRollOver = function() {  
changeColor(this.wBase\_mc, 0xffcc00);  
};  
contentBtn.onRollOut = function() {  
changeColor(this.wBase\_mc, 0x999999);  
};  
contentBtn.onRelease = function() {  
trace(this.toDo);  
this.toDo();  
};  
}  
changeColor = function (tar, col) {  
weightColor = new Color(tar);  
weightColor.setRGB(col);  
};  
funOne = function () {  
trace(“This is function one”);  
};  
funTwo = function () {  
trace(“This is function two”);  
};  
funThree = function () {  
trace(“This is function three”);  
};

[/AS]
