Copy link to clipboard
Copied
In my code, the following works as it should:
trace (sampleVar.samplevar2.currentLabel)
The current label of an instance called "sampleVar2" inside of an instance called "sampleVar" is traced.
The following works, too.
trace (this["sampleVar"].samplevar2.currentLabel)
However, what I would like to do is use "this" and a string after the first dot like this:
trace (sampleVar.this[samplevar2].currentLabel) or
trace (this["sampleVar.samplevar2"].currentLabel)
however, I get an error message saying "A term is undefined and has no properties" when I do this.Is it possible to do something like this? How should I change my code?
Why do you want to do that?
In case you think "this" is required, you only need to have a reference object in front of the brackets... "this" is just a convenient substitute for when you don't have a named object. But in your case you do...
sampleVar[samplevar2] is all you need.
Copy link to clipboard
Copied
Why do you want to do that?
In case you think "this" is required, you only need to have a reference object in front of the brackets... "this" is just a convenient substitute for when you don't have a named object. But in your case you do...
sampleVar[samplevar2] is all you need.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now