This content has been marked as final. Show 4 replies
Can't believe it ! Don't use eval() they say... but guess what ?
Only one of these three lines works. Guess which :
If someone could explain me why this does not work...
What you need to feed the array operator is a string or a variable that can be resolved to a string. And that string needs to be the sole name of an instance or property of something that can be found in that object.
So the reason the ones with the "_parent.mcMe" didn't work is because there is no object with the name "_parent.mcMe" inside of this. There is a _parent object and inside the parent object there is an mcMe, but that isn't the same thing.So you need to pick out the path one item at a time.
Should also work. And any of those string litterals could be replaced by a variable which held a string as well. Also notice that the function at the end can also be referenced since you are looking inside the mcMe object for some object with a name of testMe. But the parens which call the function need to be outside the array access because they aren't part of the name of the object.
Thanks very much !
I don't know how you figured out this because the documentation is very
light about the subject. It basically just says "use this instead of
eval()", giving very simple examples.
The syntax without dots is weird as well... Anyway...