You almost have it correct. The only reason you'd want to set classpaths via Actionscript 3.0 Settings is if you have class files that are not directly in the folder structure of your .fla file. This is true regarding the example folder structure you've given.
Since you're
.fla is not on the same branch path of your class files you
will need to set classpaths. I went ahead and set up a dummy project structure based on the example you gave us. I added a new classpath
".." which goes up one folder level (remember "." is the same level and ".." goes up one level). so now the classpath is set to the parent folder of flashfiles. Now when I want to import anything I just use the qualified folder structure and ClassName.
Here's my import statement after I set the classpath:
- Code: Select all
import classfiles.MyClass
Alternatively, I could have set the classpath to "../classfiles" in which case the import statement would be:
- Code: Select all
import MyClass
Here's some source for reference:
The main thing to remember is importing classes in Actionscript is pretty much the same as browsing the folder structure on your OS.
Also, one more thing to note. It's common in the development (Flash Dev) world to set up your
*packages with a reverse domain structure (i.e. com.myDomain.so.on.and.so.fourth). Traditionally, at its most basic level, I set a project up like this:
*packages refer to a folder hierarchy that contains classes myFolder.subFolder.anotherSubFolderWithClassesInItNotice the main .fla file is in the same branch as the com folder that contains all of my packages that will contain class files so there's no need to set a classpath in the .fla. an import statement might look like this:
- Code: Select all
import com.godsavethetween.core.utils.MyUtil
Hope this helps.