View Single Post
Old 07-01-2008, 18:58   #1 (permalink)
Emanuele
Junior Graphic Designer
 
Emanuele's Avatar
 
Join Date: May 2007
Location: Rome
Posts: 54
Send a message via MSN to Emanuele Send a message via Skype™ to Emanuele
Evaluating a String: AS 2.0

I have this problem.
I got an array. In these array are stored some functions like :
Code:
var ar:Array = new Array("Math.sqrt(Math.pow(BC,2)-Math.pow(AC,2))", "BH*BC");

then i have the variables BC, BH, AC:

Code:
BC = 5; BH = 5; AC = 5;

Now, how can i evaluate ar[0] with the correct values? I tried with value(), eval() and some other functions, but it doesn't work. (returns "undefined")
I used to do that with eval() or do() in Lingo (Macromedia Director), but now i have to do that in flash and I can't solve this problem.
Anybody can help?

Thanks.
Emanuele.
  Reply With Quote