How does Class Path work


(Adam Edney) #1

Ok i’m confused, I have added some new gui .as files (which have many sub folders) and flash develop is complaining about cant find them. I added it to my class path and it still cant find it, But some things like my world folder (src/world) doesn’t need to be listed in the ‘project class paths’ but my images files does (src/images and Global). What is the rule of thumb about class path, i’m palling out my hair!!!.

Thanks :smile:


(Martí Angelats i Ribera) #2

Usually you want the src folder as the base pakage (no need to import). Then any subfolder it’s a package. So src/net/flashpunk is net.flashpunk. Following this rule, src/world becomes the package world.

This is not mandatory at what really counts is what is where you use

package name.subname
{
    //all the code here
}

at the top of the class file (.as) this organization in folders are just becouse it way easier to see how it’s organized. Be sure you have that right.


(Zachary Lewis) #3

Your source path is the path (or list of paths) where your source code can be found. If you ever specify something like, import net.flashpunk.Engine (a fully-qualified package name), the compiler will look for a file named Engine.as at the location <source path>/net/flashpunk/Engine.as.

You can also read the documentation to learn more about the source path.


This is true in more programming languages, but ActionScript is kinda’ picky when it comes to these files. It expects files locations and packages to match. You can specify multiple class paths if you want your files to be located in specific directories.


(Martí Angelats i Ribera) #4

Oh OK, I didn’t know that. Well another thing that I’ve learned today. Thanks for the info! :smiley: (BTW, is there anything that you don’t know?)


(Zachary Lewis) #6

If there’s something I know I don’t know, I’ll usually go do some research and learn it. :whale: