3 Replies Latest reply on May 21, 2006 4:13 PM by Newsgroup_User

    If's commas

      Ive done this before, but now...Here are the exact output err msgs:

      **Error** Scene=Scene 2, layer=navbuttons, frame=15:Line 10: ')' expected
      if ((q1:RadioButton.selected = false) ||

      **Error** Scene=Scene 2, layer=navbuttons, frame=15:Line 11: ')' expected
      (q2:RadioButton.selected = false) ||

      **Error** Scene=Scene 2, layer=navbuttons, frame=15:Line 12: ')' expected
      (q3:RadioButton.selected = false))

      Total ActionScript Errors: 3 Reported Errors: 3

      What's missing please.

        • 1. Re: If's commas
          NSurveyor Level 2
          Don't use data typing, ie. :RadioButton. You only have that to make sure the right type of variable is being used, otherwise a mismatch error occurs. And also, Flash will give code hints when you enter the name of the radiobutton.

          Also, = is the assignment operator, you want the test equality operator... ==. So, it should be:

          if ((q1.selected ==false) || (q2.selected == false) || (q3.selected = false)){

          Also, if you search for: "About operator precedence and associativity" in the help panel, you'll see that == has precedence over ||, so the parenthesis are not needed.

          Also, as selected is a boolean, you can simply use the ! (NOT) operator on it... e.g. If selected is NOT true:

          if (!q1.selected || !q2.selected || !q3.selected){
          • 2. Re: If's commas
            the problem is with your paths. i assume that q1, q2, and q3 are the names of your buttons here? if that's so, then you paths should be q1.selected, etc. also, you are using an assignment operator instead of a comparison operator. your '=' should be '=='
            also, you don't have to seperate your conditions with parentheses. so, assuming that those are your button names, your script should look something like this:

            if (q1.selected == false || q2.selected == false || q3.selected == false){
            • 3. Re: If's commas
              Level 7
              if (! q1.selected || ! q2.selected || ! q3.selected){

              Might be simpler