简体   繁体   English

基类变量不可访问

[英]Base class variable is not accessible

I have two classes in Actionscript 3. I am using FlashBuilder 4.6. 我在Actionscript 3中有两个类。我正在使用FlashBuilder 4.6。 The SDK is 3.6A. SDK为3.6A。 The two classes are in a separate library. 这两个类位于单独的库中。 This library is referenced in the Active project. Active项目中引用了该库。

My first (base) class is: 我的第一堂课是:

public class BaseDTO
    {
        public var errorCode:int;
        public var errorMessage:String;

        public function BaseDTO()
        {
        }
    }

The second (derived) class is: 第二个(派生)类是:

public class Configurations extends BaseDTO
    {

    }

In my active project (non-library), I am calling Configurations like this: 在我的活动项目(非库)中,我这样调用Configurations:

var c:Configurations = new Configurations();
c.errorCode = 0;

there are two references in two separate classes. 在两个单独的类中有两个引用。 Now the problems is that in first class which is basically a creationComplete handler of the application, I am getting a compile time error: 现在的问题是,在基本上是应用程序的creationComplete处理程序的第一类中,我遇到了编译时错误:

1119: Access of possibly undefined property errorCode through a reference with static type dto.configs:Configurations. 1119:通过静态类型为dto.configs:Configurations的引用访问可能未定义的属性errorCode。

And the other class which is calling the same code is throwing a runtime exception: 另一个调用相同代码的类抛出运行时异常:

ReferenceError: Error #1056: Cannot create property errorCode on dto.configs.Configurations. ReferenceError:错误#1056:无法在dto.configs.Configurations上创建属性errorCode。

I am not sure if I have explained it enough. 我不确定我是否已经解释够了。 Let me know if there are any other questions. 让我知道是否还有其他问题。 I have been banging my head now for couple of hours now. 现在我已经快打了几个小时了。

I have tried to create a new project, tried to use the same code to reference the configuration, and it works. 我尝试创建一个新项目,尝试使用相同的代码引用该配置,并且它可以正常工作。 Extremely strange. 极其奇怪。

Any Idea? 任何想法?

The Class was declared twice, in library and the project. 类在库和项目中被两次声明。 Also, the namespace was same. 另外,名称空间是相同的。 Flex compiler should have raised warning on it though. Flex编译器应该对此提出警告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM