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

How to get current frame number of root timeline from inside a movie clip?

Explorer ,
May 23, 2013 May 23, 2013

Hello. I am using Adobe Flash pro CS6 and AS3.

Right now, I am trying to make if else statement inside a movie clip.

It's like this. it's inside a movie clip "mc_A" on root.

if(MovieClip(root).currentFrame == 1){

trace("A");

}

else if(MovieClip(root).currentFrame == 100){

trace("B")

}

If I start my swf file, I get a trace message "A", so if statemen works, but trace message B won't appear. What should I do to make this else statement work correctly?

TOPICS
ActionScript
4.8K
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 , May 23, 2013 May 23, 2013

your root timeline would need to be on frame 100 when that code executes to see "B".

Translate
Community Expert ,
May 23, 2013 May 23, 2013

your root timeline would need to be on frame 100 when that code executes to see "B".

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
Explorer ,
May 24, 2013 May 24, 2013

I know. Root timeline got to frame 100 but trace won't work, but I found the reason. If else statement(not only if else of course)works only on the frame where it is placed, so my AS won't work even though root timeline gets to frame 100. I need to use ENTER_FRAME or something.Anyway, thank you for your comment kglad.

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 ,
May 24, 2013 May 24, 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