【问题标题】:difficulty with package definition包定义困难
【发布时间】:2012-07-06 22:29:35
【问题描述】:

我在名为 sample 的文件夹中有 .fla 文件。在示例中,我有另一个名为 one 的文件夹,其中包含类。我已将类的源路径设置为这个文件夹。现在在类文件中我有

 package one
{ // code
}

但我收到错误“C:\Users\gaurav\Documents\sample\one\CDK.as, Line 1 5001: The name of package 'one' does not reflect the location of this file. Please change the package在此文件中定义的名称,或移动文件。C:\Users\gaurav\Documents\sample\one\CDK.as" ...有人可以帮我吗...

【问题讨论】:

    标签: actionscript-3 flash


    【解决方案1】:

    包反映了与您的项目相同的文件夹结构。

    如果您的项目在:

    C:\Users\gaurav\Documents\sample\sample.fla

    package one 将在:

    C:\Users\gaurav\Documents\sample\one

    如果您的包命名空间根目录与您的 FLA 相同,则无需为类设置源路径。

    如果您将类的源路径设置为文件夹,one 必须是该文件夹的子文件夹。

    即:将源路径设置为one 意味着one\one 将定义package one,如:

    C:\Users\gaurav\Documents\sample\one\one

    否则,您可以在与 FLA 不同的文件夹位置为 Flash 添加源路径,例如公共源文件夹。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-15
      • 1970-01-01
      • 1970-01-01
      • 2017-03-24
      • 1970-01-01
      相关资源
      最近更新 更多