Hi,
I seem to have a brain cramp. I’m trying to be able to have a global method that will set all global variables to null when called. I could of course name and call them all individually in the method but then I have to remember to add new globals to the method if I add others. I can get their names easily enough by looping through the ‘globals.allvariables’. But where I am screwing myself into an endless mental loop, after ‘shifting’ those global variable names out of that array, being then able to set their value to null. So I have:
var y = globals.allvariables;
for (var i = 0;i < y.length;i++)
{
var x = y.shift();
var g_var_name = 'globals.' + x
}
Can someone point me in the right direction? I’m stuck. With the ‘name’ of the variable I can set the properties of that variable easily enough (visibility etc.) but I’m all of a sudden lost in setting the VALUE of the variable. Maybe it’s late and I’m sure I’m missing something obvious but any pointers in the right direction would be much appreciated!