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

gotoAndStop if statement

New Here ,
Apr 07, 2018 Apr 07, 2018

Hi all, using a score to direct people to their correct finished screen. I am using HTML5 canvas and CreateJS.

this.nxt.addEventListener("click", fl_ClickToGoToAndStopAtFrame.bind(this));

function fl_ClickToGoToAndStopAtFrame()

{

    if (score >= 3) {

        gotoAndStop(50);

    } else if (score <= 4 && score >= 8) {

        gotoAndStop(51);

    } else {

        gotoAndStop(52);

    }

}

However, it seems it doesnt want to play ball, any help is greatly appreciated. Thankyou.Adobe Animate CC - Home

853
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

LEGEND , Apr 07, 2018 Apr 07, 2018

I think that with JavaScript 'this' is never implied. So, this.gotoAndStop(50) might work better.

Also, read your lines and think through what will happen. You have two tests that a score of 4 would match, and you have a line where you're testing for <=4 and >=8. What number could match both of those things?

Translate
LEGEND ,
Apr 07, 2018 Apr 07, 2018

I think that with JavaScript 'this' is never implied. So, this.gotoAndStop(50) might work better.

Also, read your lines and think through what will happen. You have two tests that a score of 4 would match, and you have a line where you're testing for <=4 and >=8. What number could match both of those things?

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
New Here ,
Apr 07, 2018 Apr 07, 2018
LATEST

Thanks for that, I knew something didnt look right.

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