[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 439
  • Last Modified:

replacing eval

i want to access a element of a object using the name, i original taught that eval would do the job but its been depricated so adobe suggent using syntax this['blah' + i ]
i have tried this but it aint working

            trace(i )     // is equal to name
            trace(  printLabelArray[pi].dispensingItemPrintElementdrug.templateElementText.text)  // prints John
                        trace(  this["printLabelArray[pi].dispensingItemPrintElement"+i]) // i get undefined here
                        trace(  this["printLabelArray[pi].dispensingItemPrintElement"+i+".templateElementText.text"] ) // and here

1 Solution
jockmahon01Author Commented:
Figured this one out was been silly , need to use value for pi aswell

trace( printLabelArray[  pi  ]["dispensingItemPrintElement"+i].templateElementText.text);

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now