2 Replies Latest reply on Jul 10, 2006 1:46 AM by jpwrunyan

    Syntax Check not working?

    jpwrunyan Level 1
      Hi, I am getting some weird behavior in Flex Builder and not sure what the cause is... originally I had this as an AS class:
      package AS.common.controls {
      import mx.controls.DateField;
      import mx.formatters.DateFormatter;
      public class StrictDateInput extends DateField {
      ..
      }
      private class StrictDateFormatter extends DateFormatter {
      ..
      }
      }

      and there was no error... now, I have made a few changes to the code (actually I just tried putting the class in an .mxml file.. I didn't even change the original code) and I get an error for the private class definition. If I change it to internal the error disappears. Maybe this is just that I don't understand the difference between private classes and internal but here is where I am getting frustrated:
      There are no errors displayed in Flex builder but when I run an application that has the StrictDateInput class, the pop-up appears in Flex Builder saying that I have an error in my project do I want to run?

      The only way I can get the thing to run is to comment out the entire internal class definition and THEN extend from mx.controls.DateField (even though I have imported it in the package definition).

      Any ideas what is going on here? Is the code bad? Is Flex Builder giving bad messages? Or is Flex Builder not checking syntax properly?
        • 1. Re: Syntax Check not working?
          Level 7
          jpwrunyan wrote:
          > Hi, I am getting some weird behavior in Flex Builder and not sure what the
          > cause is... originally I had this as an AS class:
          > package AS.common.controls {
          > import mx.controls.DateField;
          > import mx.formatters.DateFormatter;
          > public class StrictDateInput extends DateField {
          > ..
          > }
          > private class StrictDateFormatter extends DateFormatter {
          > ..
          > }
          > }
          >
          > and there was no error... now, I have made a few changes to the code (actually
          > I just tried putting the class in an .mxml file.. I didn't even change the
          > original code) and I get an error for the private class definition. If I
          > change it to internal the error disappears. Maybe this is just that I don't
          > understand the difference between private classes and internal but here is
          > where I am getting frustrated:

          The private class declaration inside the package is not legal. It was
          legal in some beta versions, though.

          As you discovered, you need to make the class "internal". Alternatively,
          you can define the class outside of the package. For example,

          package AS.common.controls {
          import mx.controls.DateField;
          public class StrictDateInput extends DateField {
          ..
          }
          }

          import mx.formatters.DateFormatter;
          class StrictDateFormatter extends DateFormatter {
          ..
          }

          Note that the import statements within the package do not apply to the
          class defined outside the package. You may need to repeat the same
          import statements.

          Defining the class outside of the package makes it truly "private".
          Classes declared as "internal" are visible to other classes in the same
          package.

          -- Greg Dow
          -- Adobe Flex Builder Team



          • 2. Re: Syntax Check not working?
            jpwrunyan Level 1
            Thanks, I checked the docs and found the private keyword was just for properites. Also, like you said, once I put the other class outside the package, it worked.