我试图通过movieclip(类名:Abc)访问“内部”类Abc。由于某些原因,我不能公开指定它。我怎样才能访问它?
答案 0 :(得分: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
}
}
}