6 Replies Latest reply on Oct 25, 2007 8:35 AM by kglad

    Document Class Error

    scrfix Level 1
      I am working with Windows Vista Business if that makes a difference in this question.
      I am testing a class file for NoScale called NoScale.as
      I have created the class file attached.
      I have saved the class file in the same location as the fla file.
      I put in the document.class box: NoScale

      Whenever I publish, I receive the following error:
      5008: The name of definition 'Main' does not reflect the location of this file. Please change the definition's name inside this file, or rename the file. C:\Users\%UserName%\Desktop\Website\Reference Flas\NoScale.as
      (Note: I have replaced my username with %UserName%)

      I have attempted to put C:\Users\%UserName%\Desktop\Website\Reference Flas\NoScale.as into the document class box and I receive an error telling me that the \'s are incorrect and are not allowed.

        • 1. Re: Document Class Error
          Level 7
          The class name must reflect the name of the file -- or vice-versa.

          Either rename your file Main.as, or rename your class NoScale

          • 2. Re: Document Class Error
            scrfix Level 1
            Thanks. That cleared that error up however now I have another error with the compiler.

            1046: Type was not found or was not a compile-time constant: MouseEvent.

            Any ideas?


            • 3. Re: Document Class Error
              scrfix Level 1
              Strangely enough,

              When I do not link a class to this project, I get no compile errors whatsoever and my project works no problems.

              When I link a class file to this project, I all of a sudden get a bunch of compile errors telling me that I do not have
              import flash.blah.blah.blah.blah.

              I have figured out all compile errors except for the following:
              1180: Call to a possibly undefined method LoaderInfo.
              1120: Access of undefined property InterpolationMethod.

              What class file or files do I have to link in order to get rid of these errors?


              • 4. Re: Document Class Error
                kglad Adobe Community Professional & MVP
                don't you know what your classes are doing? if you have a class that uses the loaderinfo class and is not subclassing a class that has access to that class you need to import import flash.display.LoaderInfo into that class. and if you're using beginGradientFill() or lineGradientStyle() you need to import flash.display.InterpolationMethod into that class.
                • 5. Document Class Error
                  scrfix Level 1
                  I know that the classes are code that is prewritten so you can use the functions within.

                  The answer to your question is No, I don't know what the classes are doing because I am just beginning with AS3 and Flash 9.

                  However, my question is Why does my code work with no problems without importing any of those classes into the code when I don't put anything into the Document class: [ box ].

                  As soon as I wanted to give my flash header the ability to resize itself, I found out that I had to create a .as or class file with the above code in it to give it that capability. Once I did that I found out that I had to use the document class box in order to link that class file to the SWF. Once I created a proper .as file named NoScale and typed NoScale into the document class box, all of a sudden a ton of errors happen wanting me to include the flash.blah.blah files. If I remove the NoScale from the document class box and do nothing else, the project works just fine.

                  That is what I don't understand.


                  Adding the following did fix the errors. Thanks.
                  import flash.display.LoaderInfo;
                  import flash.display.InterpolationMethod;
                  • 6. Re: Document Class Error
                    kglad Adobe Community Professional & MVP
                    class files only import the classes that are explicity specified. your fla imports all the classes it needs without requiring anything to be explicitly imported.