General question

Okay I’m stupid…

but I still do not fully understand when to use “eval(varname)” and when not to. What does EVAL do?

Stanley

The eval() function is used to access variables, properties, objects, or movie clips. If the expression is a variable or a property, that value is returned. If the expression is an object or movie clip, it’ll tell you and give you a reference to that.

Think of it as evaluating the contents of a named object.

… and it is very bad practice…

why do you say it’s bad?

i personally never use it, preferring array notation, but never heard that it’s “bad”

I don’t know, it just feels ugly. It makes everything unclear. :confused:

And using eval(something)= was deprecated if I remember correctly. [SIZE=1]was it? I think it was…[/SIZE]

actually, eval(something)=x

is more than just deprecated, it doesn’t work at all in flash mx! you can’t evaluate a variable and assign it something. you’d have to say:

mything=eval(something);
mything=x;

i am newbie but about the eval function, i think it is very useful in flash, most because in can concatenate a string to a int ad this is very useful when for example you want to do a search in flash searching words on a .txt file that contais variables…

Bit >> So it’s bad :evil:
Gabriel >> But it has utilities, for sure. But nothing you can’t do with something else. :cowboy:

i dont think its bad, for some things is the eval function is the best, many problems that i have in flash i resolve it whith the eval, probably we can do the same things in other way, but that way cannot be the most optimized…

i don’t think it’s inherantly “bad”, but it’s true that anything you can do with eval, you can do in another, possibly better way. as i said, i never use it personally.