Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Issues tracing currentLabel?

Community Beginner ,
Jan 20, 2013 Jan 20, 2013

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:

currentLabelsample.JPG

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?

TOPICS
ActionScript
608
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 20, 2013 Jan 20, 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.

Translate
Community Expert ,
Jan 20, 2013 Jan 20, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 21, 2013 Jan 21, 2013

Thanks.Moving the array definition solved the problem.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 21, 2013 Jan 21, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines