1 Reply Latest reply on Jun 17, 2006 3:17 PM by D._J._Faber

    Access Variable from a dynamic name


      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.