Copy link to clipboard
Copied
I am working on a project with a symbol that contains 4 frames. The instance name of the symbol is numBlock.
Frames 3 and 4 of numBlock contain symbols with 3 frames each. The is a visual representation of numBlock:
The names of the instances on frame 3 and 4 of numBlock are "scroller1" and "scroller2".I have created the following array to target these two symbols:
var scrollers:Array=[numBlock.scroller1,numBlock.scroller2]
When numBlock is on frame 3 or 4, I want to trace scroller1 or scroller2's currentLabel. Using the following code, I can do that:
numBlock.gotoAndStop("3");
numBlock.scroller1.gotoAndStop(2);
trace (numBlock.scroller1.currentLabel)
However, when I change the third line to this, I get an error message:
trace (scrollers[0].currentLabel)
Any ideas on how to solve the problem?
scrollers elements are likely undefined when you define scrollers.
i'm not sure what you're trying to do but if you want to reference, for example, numBlock.scroller1 when it doesn't exist (ie, when numBlock is not on its 3rd frame), it's not possible. an object has to exist before it can be referenced.
Copy link to clipboard
Copied
scrollers elements are likely undefined when you define scrollers.
i'm not sure what you're trying to do but if you want to reference, for example, numBlock.scroller1 when it doesn't exist (ie, when numBlock is not on its 3rd frame), it's not possible. an object has to exist before it can be referenced.
Copy link to clipboard
Copied
Thanks.Moving the array definition solved the problem.
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now