3 Replies Latest reply on May 21, 2007 9:21 AM by kglad

    Packages and class path root

    hciguy
      Hi,

      Is it possible to make a package and place it in the root of the classpath? I.e. put it in AS3.0/Classes/myClass.as ? I couldn't get it to work until I put the myClass.as in a folder with the same name as the package name but I wonder if it is possible to place a package directly in the root? What would you name it?

      Thanks!
        • 1. Re: Packages and class path root
          kglad Adobe Community Professional & MVP
          read about packages in "programming with as 3" in the help files. i think you have some misunderstandings. the following address your specific questions but i don't think it will clarify things for you.

          you can place your package anywhere you want as long as it's in the class path. and, of course, you need to put your file in a folder with a matching package name - that's one of the main benefits of using packages and is used to prevent name conflicts.
          • 2. Re: Packages and class path root
            hciguy Level 1
            Yes I am working my way through Programming in AS3 now....hence my questions :)

            I tried to just place my package anywhere in the class path and kept getting an error on the package name. If it isn't in a folder, is the package name not defined - as in:

            package
            {
            public class whatever
            {

            }
            }

            I'm just wondering if it is in the root of the classpath - i.e. not in a folder - how to get it to work because it kept giving me errors until I placed the package in a folder of the same name.

            I don't see how I can put it anywhere I want in the classpath if it needs to be in a folder of the same name as the package. Doesn't that restrict me and go against putting it just anywhere?

            Sorry to bother with these questions. I am reading As3 programming but it doesn't always make things perfectly clear.

            Thanks so much!
            • 3. Re: Packages and class path root
              kglad Adobe Community Professional & MVP
              if you don't name your package then that file must be in the class path. your class paths are defined in file/publish settings/flash/actionscript version 3/settings.

              you can use the browse to path button to navigate to your class as file and put it in the class path.