AS3 packages and folder locations
I'm getting this error that says that my package is name doesn't reflect the location of my file. What do I need to do to fix this? I've googled, 开发者_运维百科changed the name of my file, added classpaths. Please provide detailed instructions. I'm having trouble with this.
Code:
package CMA10{
//Classes and stuff in here
}
Error: (Includes directory information)
/Users/Moshe/Dropbox/Development/AIR/Projects/CMA10/campCD.as, Line 1 5001: The name of package 'CMA10' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. /Users/Moshe/Dropbox/Development/AIR/Projects/CMA10/campCD.as
If your package looks like:
com.motion.util
The util.as containing the util class
file should be located inside: root of your flash file/com/motion/util.as
A classes package needs to be identical to the folder structure that you have the class in and if the top folders location is not the same location as the .fla, a class path needs to be set in the .fla's Actionscript settings to point to the location of that top folder.
Class:
package
{
public class ClassName
}
Import:
import ClassName;
Document Class: ClassName
This class is in the same directory as the .fla that needs to use it or a class path pointing to the folder containing this class has to be setup in the Actionscript settings of the .fla.
Class:
package com.something.utils
{
public class ClassName
}
Import:
import com.something.utils.ClassName;
Document Class: com.something.utils.ClassName
This class must be located in "com\something\utils" folder. The "com" folder must be located in the same directory as the .fla that needs to use it or a class path pointing to the folder containing the "com" folder has to be setup in the Actionscript settings of the .fla.
精彩评论