问题
I posted my original question here. Which got me to this point. I think I'm doing everything just as @Atriace suggested, but I get this error:
C:\Users\User\Desktop\oldProjects\nealdavis\calculations\GeoMath.as, Line 1, Column 1 5001: The name of package 'nealdavis.calculations' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. C:\Users\User\Desktop\oldProjects\nealdavis\calculations\GeoMath.as
Since, I think I'm doing everything as I've been suggested to, I thought I'd upload the screenshots. Maybe there is something amiss that I don't even know to tell you about. Thanks.
回答1:
The problem is that your tutorialAsteriod file can only see a sub-folder called calculations when it tries to compile. Yet your Document.as code tells it to :
import nealdavis.calculations.GeoMath;.
With that line, it is expected that Document.as is in the same location as a sub-folder called nealdavis which in turns contains that calculations sub-folder inside. You only have a sub-folder called calculations hence you get the error.
To Fix :
Either make a new extra sub-folder called nealdavis and then move that calculations folder into it so that the final setup is : Document.as + folder called nealdavis + inside that will be calculations sub-folder.
Your folder structure should be like this example :
Desktop > oldProjects > nealdavis > (Document.as here... + ) nealdavis > calculations
Or else just do : import calculations.GeoMath;.
来源:https://stackoverflow.com/questions/37096892/as3-trying-to-import-a-custom-class-files-in-wrong-order