Answered
Access Variable from a dynamic name
Hello,
I have a the following example variable in a script defined as such:
mcDrg05OriginalX = mcDrg05._x;
I wish to access this variable data within a button script, but dynamically by assembling the actual variable name:
newName = holdName[landingCount];
relocateIDx = (newName + "OriginalX");
newName accesses the original name from an array, and relocateIDx assembles the full variable name to be mcDrg05OriginalX. Now I wish to access the original numerical value from that variable name, but how?
I tried:
_root[newName]._x = (relocateIDx);
_root[newName]._x = [relocateIDx];
maybe the answer is out there.
Thanks in advance.
I have a the following example variable in a script defined as such:
mcDrg05OriginalX = mcDrg05._x;
I wish to access this variable data within a button script, but dynamically by assembling the actual variable name:
newName = holdName[landingCount];
relocateIDx = (newName + "OriginalX");
newName accesses the original name from an array, and relocateIDx assembles the full variable name to be mcDrg05OriginalX. Now I wish to access the original numerical value from that variable name, but how?
I tried:
_root[newName]._x = (relocateIDx);
_root[newName]._x = [relocateIDx];
maybe the answer is out there.
Thanks in advance.
