Groups | Blog | Home
all groups > macromedia mobile and devices flashlite > january 2005 >

macromedia mobile and devices flashlite : How to execute String("2*x")


Tom Krcha
1/25/2005 10:46:13 AM
Hi does anyone know how to execute some data, we get from server, such as "2*x"?

For example:
i need from it count equation:
y = 2*x;
but realize you need to use dynamic data:
someVar = "2*x";

but this doesn't fuction:
y = eval(someVar);
Justin E-C
1/25/2005 6:07:38 PM
Hi Tom,

This unfortunately isn't possible. eval is only used for taking a string and
evaluating it as a variable and returning the value of the variable. It isn't
the same as the javascript eval function.

If what you are wanting to do is have something close to a function calling a
name runs some bit of functionality, then the closest solution is going to be
call(). Make a keyframe somewhere on the timeline give it a label, add your
code there, then

call("myframeLabel")

(this doesn't advance the play head, it is essentially the same as splicing
the code of the called frame into the current frame/button)
Tom Krcha
1/25/2005 6:22:20 PM
AddThis Social Bookmark Button