Skip to main content
Known Participant
January 21, 2013
Answered

Issues tracing currentLabel?

  • January 21, 2013
  • 1 reply
  • 641 views

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?

This topic has been closed for replies.
Correct answer kglad

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.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
January 21, 2013

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.

withertonAuthor
Known Participant
January 21, 2013

Thanks.Moving the array definition solved the problem.

kglad
Community Expert
Community Expert
January 21, 2013

you're welcome.