Flex中,在一个AS文件中定义两个类的实现方式

如下是A.as文件定义了两个类的代码:

package classes { public class A { public function A() { var b:B = new B(); } } } class B { public function B() { trace("Hello"); } }

Class B is only visible to class A - you cannot have more than one visible class in one file (exactly what the error message states).

And you cannot have more than one package in a file.

一个as文件中只能一个package,而且只能有一个对外可见的as类,文件内不可见的类只能在可见的类内使用

http://stackoverflow.com/questions/5888494/flex-4-two-classes-in-one-file

你可能感兴趣的:(Flex中,在一个AS文件中定义两个类的实现方式)