Skip to main content
Inspiring
May 23, 2013
Answered

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

  • May 23, 2013
  • 1 reply
  • 4940 views

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?

This topic has been closed for replies.
Correct answer kglad

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

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 23, 2013

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

Inspiring
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.

kglad
Community Expert
Community Expert
May 24, 2013

you're welcome.