Skip to main content
Participating Frequently
August 24, 2007
Answered

Can a movie detect what level it is on?

  • August 24, 2007
  • 1 reply
  • 263 views
Hello all:

I have a series of movie.swfs that are repeatedly looping in at different levels and I am running into some trouble debugging them and tracking what is going on. Is there a way that I can set up a trace with a command that will spit out the number for the level it is currently on? For example one loop through might run the clip at level 400 while the next time through it would show up on level 500. And I would like to figure out in my traces what level it is on when it gives me certain variables.

Thank you in advance,
Garrett
This topic has been closed for replies.
Correct answer
To determine which level you are on, simply use:
trace(this);

as the String conversion of a movieclip will give a absolute path starting with _leveln.___

Or, if you want just the number:
trace(String(this).split('.')[0].slice(6));

1 reply

Correct answer
August 24, 2007
To determine which level you are on, simply use:
trace(this);

as the String conversion of a movieclip will give a absolute path starting with _leveln.___

Or, if you want just the number:
trace(String(this).split('.')[0].slice(6));
gbowhallAuthor
Participating Frequently
August 24, 2007
Thank you!

That was remarkably easy.
=)
August 24, 2007
You're welcome.