ActionScript Error #5001: The name of package ‘com.cjm’ does not reflect the location of this file. Please change the package definition’s name inside this file, or move the file
Description:
This ActionScript error is a very common one especially if you haven’t defined a good package and class structure. The simple answer is that you misspelled something in your package description or you saved the class in the wrong folder. (See example 1)
Another reason that you can get this error in Flash is because you have a Document Class and you have specified the classpath in the “Document class:” field and you have something different typed in your package. You might say well that is not possible. If your default classpath is defined in the AS3 setting then the file will compile and the class will work properly if you remove the classpath all together out of your package. This is not recommended because it is not good practice. Please review the example2 below.
Solution:
Check your paths in the package, class and ‘Document Class’.
Example 1
Bad Code
package com.ckm
{
}
Good Code
package com.cjm
{
}
Example 2
Good Code – Bad “Document class:” definition
package com.cjm
{
public class MyDocClass
{
public function MyDocClass()
{
}}}
Good Code – Good “Document class:” definition
package com.cjm
{
public class MyDocClass
{
public function MyDocClass()
{
}}}
And those are two ways to resolve ActionScript Error #5001
As Always – Happy Flashing