I haven't used AS2 before and I have to fix someones code which was written in AS2 and is using flash. Here is the AS2 code:
var evalOpt = eval("option"+optObj);
var evalPlace = eval("_root.placed"+plcObj);
trace(evalOpt);
trace(evalPlace);
set("ans"+plcObj, evalOpt);
I traced both evalOpt and evalPlace. evalOpt is
<b>0</b>
and evalPlace is
_level0.placed6
. What does the set() function do in AS2? I looked through the rest of his code and did not find the set() function anywhere.
Note: I have opened it in Flash and on the top it says "AS1 / AS2".. I don't know if this is AS1 or AS2, but I am assuming it is AS2.
In AS2
set()function does the assignment. First parameter is variable name asString, second parameter is the value you want to assign. Important thing to note about first parameter, is that if you have a variable say:and you call
then variable
colorwill not be set to "blue", instead new variable named"orange"will be created and value "blue" assigned to it.In your example function
set()assigns whatever data is in variableevalOptto variable name that evaluates from"ans"+plcObj