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文件中。
最后编辑时间为: 2017-11-27 05:54 pm