0
votes

I have a movieclip on stage that is a black screen and nothing else. Just a black rectangle with frames that have frame instance names. The overall instance name of this black screen is simply "BlackScreen".

What I am trying to do is do BlackScreen.gotoAndPlay("BSL") from another movieclip that's on the same stage in a different layer of the stage. The "BSL" is one of the frame instance names.

This seems like it would work, as all I am trying to do is play some frames. But whenever I test the project, it gives me this for all the instances I use BlackScreen.gotoAndPlay("BSL"):

Symbol 'Darkened Code', Layer 'Head', Frame 1119, Line 1, Column 1 1120: Access of undefined property BlackScreen.

What I'm assuming is that a movieclip can't detect other movieclips? Or am I just doing something wrong?

1

1 Answers

0
votes

You need to access BlackScreen through _root (as2) or root (as3). When you write code on the timeline of a movieclip, the "scope" of the code is that of the movieclip and not the main stage. By trying to access BlackScreen here, it will look for BlackScreen inside the Darkened Code movieclip, you need to tell it explicitly to look on the main stage using root

eg.

root.BlackScreen.gotoAndPlay("BSL")