Skip to main content
tropicanaclock
Known Participant
March 19, 2013
Answered

Broken If Statment

  • March 19, 2013
  • 1 reply
  • 398 views

Im working on an if statement that checks values, and depending on the programs mode it will require different values. For some reason it breaks with my else statements. I need someone to take a look and see what im getting wrong.

Right now it just automatically jumps to this statement

      else if (menu1.currentFrame == 3 && menu1.panelmenu.currentFrame == 5 && elecBrkNums == 21  && quizMode =="on" )

          {


function electokay():void

{

          if (menu1.currentFrame == 3 && menu1.panelmenu.currentFrame == 4 && electricLenNums != 0 && quizMode == "off")

          {

                    menu1.panelmenu.gotoAndStop(5);

          }

          else if (menu1.currentFrame == 3 && menu1.panelmenu.currentFrame == 4 && electricLenNums == 1 && quizMode =="on" )

          {

                    menu1.panelmenu.gotoAndStop(5);

          }

          else if (menu1.currentFrame == 3 && menu1.panelmenu.currentFrame == 4 && electricLenNums != 1 && quizMode =="on" )

          {

                    trace("incorrect");

          }

          if (menu1.currentFrame == 3 && menu1.panelmenu.currentFrame == 5 && elecBrkNums != 0 && quizMode == "off")

          {

                    inputClips.visible = true;

                    ui.visible = true;

                    mod.visible = true;

                    menu1.visible = false;

                    mod.gotoAndStop(10);

                    clearfun();

                    menu1Seeio();

                    electoff.nextFrame();

                    electoff.electinput.nextFrame();

                    inputClips.visible = false;

          }

          else if (menu1.currentFrame == 3 && menu1.panelmenu.currentFrame == 5 && elecBrkNums == 21  && quizMode =="on" )

          {

                    inputClips.visible = true;

                    uiMes.visible = true;

                    uiMes.gotoAndStop(1);

                    ui.visible = true;

                    mod.visible = true;

                    menu1.visible = false;

                    mod.gotoAndStop(10);

                    clearfun();

                    menu1Seeio();

                    electoff.nextFrame();

                    electoff.electinput.nextFrame();

                    inputClips.visible = false;

          }

          else if (menu1.currentFrame == 3 && menu1.panelmenu.currentFrame == 5 && elecBrkNums != 21  && quizMode =="on" )

          {

                    trace("incorrect");

          }

}

This topic has been closed for replies.
Correct answer Ned Murphy

Use the trace function before any of the conditionals to see what the values of the conditions are.  That will help you determine why things land where they land

You can simplify your efforts by combining all the conditions that repeat into one initial condition (namely: menu1.currentFrame == 3, menu1.panelmenu.currentFrame == 4, and menu1.panelmenu.currentFrame == 5  )

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
March 19, 2013

Use the trace function before any of the conditionals to see what the values of the conditions are.  That will help you determine why things land where they land

You can simplify your efforts by combining all the conditions that repeat into one initial condition (namely: menu1.currentFrame == 3, menu1.panelmenu.currentFrame == 4, and menu1.panelmenu.currentFrame == 5  )

tropicanaclock
Known Participant
March 19, 2013

Ah right I forgot about my old friend trace