# Troubles using eval() and \[\]

**URL:** <https://forum.kirupa.com/t/troubles-using-eval-and/114643>\
**Category:** Uncategorized\
**Created:** [June 30, 2004, 10:54am UTC](https://forum.kirupa.com/t/troubles-using-eval-and/114643 "2004-06-30T10:54:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mindfriction](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mindfriction/32/172_2.png) [@mindfriction](https://forum.kirupa.com/u/mindfriction)\
**Post date:** [June 30, 2004, 10:54am UTC](https://forum.kirupa.com/t/troubles-using-eval-and/114643/1 "2004-06-30T10:54:01Z")

</div>

Hi,

Ive been searching here and Flashkit for an answer, and I’m not having much luck. I thought I had it mastered, but i was wrong :(. Could someone please explain to me how I can use the eval() or ‘[]’ properly to make a dynamically generated function call ?

Below is a “small scale” example of what Im trying to achieve.

```auto

MovieClip.prototype.formatShape = function(){
	trace("formatShape called!!!");
	with(box_mc){
		setRGB(arguments[0]);
		_width=arguments[1];
		_height=arguments[2];
	}
	
};

myShapes=new Array();
myShapes[0] = {mc:box_mc, action:{func:"formatShape", args:[0xFF0000, 200, 100]}};

myShapes[0][mc].myShapes[0][action[func]](myShapes[0][action[args]]);

stop();

```

Essentially, the scenario in this case is there are a series of shapes on the stage. And each shape can call a set function and pass a number of parameters for the relevat formatting required. Although in this case there is only one formatting function called ‘formatShape’.

Thanks in advance
