3 Replies Latest reply on Oct 8, 2007 10:40 PM by atta707

    How to execute a string as AS3 code

      I'm converting an application from HTML/javascript to Flex/ActionScript, and I've run into a problem. I need to be able to take a string and execute it as if it were a code statement.

      In javascript, it looks like this:

      var foo = 2;
      var bar = 3;
      var formula = "foo * bar";
      var result = eval(formula);
      // 6

      How do I do this in ActionScript 3?