Flash AS3 中类的定义不再要求一个类一个文件了

土人老周 分类, 0 个评论 ,阅读数: 2

Unlike previous ActionScript versions, ActionScript 3.0 does not have the one file, one class restriction that limits you to using only one class per file. Using ActionScript 3.0, you can save the source code for more than one class in a single .as file.

but in general, this is considered a bad programming practice, for a couple of reasons:

It is difficult to reuse individual classes if they are packed together into a single large file.
It is difficult to locate the source code for a specific class when its filename does not correspond to the class name.
For these reasons, Adobe recommends that you always save the source code for each individual class in its own file, and give the file the same name as the class.

Flash AS3 中类的定义不再要求一个类一个文件了,可以多个类在同一个.as文件中。

但是,Adobe又说由于以前的一些习惯等原因,现在还是推荐一个类一个文件,并且 类文件的名字最好和文件中的类的名字一致。