# Eval in AS3 replacement problem

**URL:** <https://forum.kirupa.com/t/eval-in-as3-replacement-problem/306688>\
**Category:** flash\
**Created:** [March 19, 2010, 11:34pm UTC](https://forum.kirupa.com/t/eval-in-as3-replacement-problem/306688 "2010-03-19T23:34:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DropMeSomeCode](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@DropMeSomeCode](https://forum.kirupa.com/u/DropMeSomeCode)\
**Post date:** [March 19, 2010, 11:34pm UTC](https://forum.kirupa.com/t/eval-in-as3-replacement-problem/306688/1 "2010-03-19T23:34:16Z")

</div>

Hello folks,  
I’ve been trying to run a function from a string AS3 style supposed to substitute eval(), which is very easy, but there is a problem when running it from a text input box (I’m trying to create a program where users can enter variable names that can convert to functions):

Make sure you make a text input box in your FLA with the name of “ **runtxt** ”, and the value inside the text input box of “ **run** ” (without the quotes of course).

function run():void{  
trace(“function run() runs”);  
}

var runString:String = “run”;  
**thisrunString; // why does it work here but not when I grab the string from a text box below??**  
var runtxt1:String = runtxt.text.toString();  
var newtxt1:String = new String("");  
for(var i:int = 0; i\<runtxt1.length; i++) {  
//trace(runtxt1.charAt(i));  
newtxt1 += runtxt1.charAt(i);  
}  
trace(runtxt1);  
**thisruntxt1; // does not work  
thisnewtxt1; // even a brand new String with concatenation of the text input’s text does not work**

The question is : Why does it NOT work when I grab the string from the textbox “runtxt” ?? I tried it without the charAt code for loop by just running thisruntxt1; and it does not work either for whatever reason.
