Skip to main content
eugener2418576
Inspiring
September 21, 2018
Answered

Targeting main stage for navigation 'scope'

  • September 21, 2018
  • 1 reply
  • 328 views

Hi there,

I'm getting an error when it comes to using this.gotoAndPlay('end'). I have a label with 'end' so that I don't need to use frame numbers

Essentially, I have a few drag functions. The function 'finish();' fires at the 'mouseup' per drag (so right at the end).

Finish function looks like this:

function finish(){
     score++;
     console.log(score);

     if(score == 3){

          this.gotoAndPlay('end');

}
}

The score gets to 3 but then..

I'm getting an error on this.gotoAndPlay('end'). I assume it's because of the 'scope'..

Any help is greatly appreciated!

This topic has been closed for replies.
Correct answer eugener2418576

I solved this myself. The 'scope' was wrong.

var root = this; at the start of the program and then root.gotoAndPlay('end'); works very well.

1 reply

eugener2418576
eugener2418576AuthorCorrect answer
Inspiring
September 21, 2018

I solved this myself. The 'scope' was wrong.

var root = this; at the start of the program and then root.gotoAndPlay('end'); works very well.

Legend
September 21, 2018
eugener2418576
Inspiring
September 23, 2018

Thanks mate.