5 Replies Latest reply on Mar 28, 2007 1:20 PM by Rothrock

    syntax error

      Hi everybody :D,

      I can understand why I am getting a syntax error???

      **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 10: Unexpected '&&' encountered
      if (testtext.text >= 010107) && (testtext.text <= 080107) {

      Total ActionScript Errors: 1 Reported Errors: 1



      you have any idea how I can make this work ??? thanks ! :D
        • 1. Re: syntax error
          Rothrock Level 5
          The entire conditional, the part that evaluates to true/false, must be inside the parens. So you need either of these:

          if ((testtext.text >= 010107) && (testtext.text <= 080107))
          if (testtext.text >= 010107 && testtext.text <= 080107)
          1 person found this helpful
          • 2. Re: syntax error
            hi... thanks for the reply ...

            but still doesnt work ... any ideas ????


            **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 8: ')' expected
            if (testtext.text >= 010107 && testtext.text <= 080107)

            **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 10: Unexpected '}' encountered
            }

            Total ActionScript Errors: 2 Reported Errors: 2
            • 3. Re: syntax error
              Rothrock Level 5
              You really need to read the help files. And pay attention to what the error message is telling you. It is telling you that it is running into an unexpecte curly brace. This means your curly braces aren't properly matched. A correct if statement looks like this

              if(somecondition){
              some code
              }
              • 4. Re: syntax error
                Level 7
                What are you comparing? text to a number? If it's text, then 010107 would
                need to be in quotes.

                And what do you mean "greater than" 010107 ?

                pseudocode:

                perhaps something like ConvertToNumber(texttext.txt) >= 10107 ?

                "Kaneon" <webforumsuser@macromedia.com> wrote in message
                news:eue8tu$8rl$1@forums.macromedia.com...
                > Hi everybody :D,
                >
                > I can understand why I am getting a syntax error???
                >
                > **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 10: Unexpected '&&'
                > encountered
                > if (testtext.text >= 010107) && (testtext.text <= 080107) {
                >
                > Total ActionScript Errors: 1 Reported Errors: 1
                >
                >
                >
                > you have any idea how I can make this work ??? thanks ! :D
                >
                > var TestVar = info.text;
                > flightDateChooser.onEnterFrame = function() {
                > trace(info.text);
                > testtext.text = info.text;
                > };
                > var onEnterFrame = function () {
                > if (testtext.text >= 010107) && (testtext.text <= 080107) {
                > trace ("vid1")
                > }
                >
                > }
                >


                1 person found this helpful
                • 5. Re: syntax error
                  Rothrock Level 5
                  Oh, that Jeff is right onto the next problem you will have once you get passed the syntax errors.

                  He is correct in that if you are comparing String (text) – which oddly enough the text property of a TextField is – you will have problems. The other problem will be if you imagine 010107 to be a number. When a number begins with zero, Flash takes that to mean that you wish to work in base 8.

                  Finally if you are trying to do something with dates, I would suggest either working with the Date class or doing a year/month/day kind of format. That makes it easier to sort by greater than, less than, etc.
                  1 person found this helpful