1 Reply Latest reply on Jul 17, 2013 2:10 PM by nameless numberheadman

    Help with my Flash Builder code.

    jsmith0520

      Hello,

       

      I am getting two errors, well four but three are the same. 1083 && 1084.

       

      here is my code, can someone look over it and tell me what I am doing wrong. I am fairley new to Flash Builder so please no harassement.

       

      //Check The Login

                      var userName: String= "requestofone";

                      var passWord: String= "robots96";

                          if (userName == "requestofone" && passWord == "robots96"){

                          trace("Welcome requestofone")

                          }else{ (userName != "requestofone")

                          trace("User not found. Try again.")

                          }else if{ (passWord != "robots96")

                          trace("Password does not match our records.");

                          }

                     

                          //Tire Pressure

                         

                          var frontTires:Array = ['43', '43'];

                          var rearTires:Array = ['45', '45'];

                          if (frontTires:Array != uint: 43 && rearTires:Array != uint: 45){

                              trace("Get Your Tires Checked Out")

                          }else{ (frontTires:Array == uint: 43) && (rearTires:Array == uint:45)

                              trace("Tires pass the spec")}

       

       

       

       

      DescriptionLocation
      1083: Syntax error: else is unexpected.line 48
      1084: Syntax error: expecting rightparen before colon.line 56
      1084: Syntax error: expecting rightparen before colon.line 58
      1084: Syntax error: expecting rightparen before colon.line 58

       

      I have been trying to figure this out for a while now. Please help.

        • 1. Re: Help with my Flash Builder code.
          nameless numberheadman

          Not to be nasty or "harass", but you need to go back and learn the syntax.  Each line of code should end with a semicolon, and I'm also not sure what you are trying to accomplish with your "else{(userName != "requestofone")".  Are you trying to do a conditional test?  If so you need to use an "else if".  That said, the "else if" you do use is incorrect.  The parens should come out side the curly braces like you did for the initial "if" condition, and the "else if" needs to come before your final "else" since that is where the flow will go when no previous condition is met.

           

          Example:

           

          if (a == b){

          trace("do something");

          }

          else if (b == c){

          trace("do something different");

          }

          else{

          trace("do some default thing");

          }

           

          I hope this helps.