0

我正在尝试通过影片剪辑(类名: Abc )访问“内部”类 Abc 。由于某些原因,我无法将其指定为公开。我怎样才能访问它?

4

1 回答 1

0

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/statements.html#internal

内部类仅适用于同一个 EXACT 包中的其他类。创建一个位于同一个包中的类,您可以访问它。

让我们用这个例子

package com.app {
    internal class Abc { }
}

package com.app.sub { 
    public class OtherClass {
        // classes in sub package cannot access or any other package
        // attempting to instantiate a class when outside its package
        // results in a compiler error
    }
}

package com.app {
    public class UsesAbc {
        function UsesAbc () {
            var abc:Abc = new Abc();
            // this is ok because they live in exactly the same package
            // this class can be use as a proxy for Abc
            // because the class is public
        }
    }
}
于 2012-10-15T02:47:58.553 回答