Learning ActionScript 2.0 in Adobe Flash |
|
|
|
| Best Practices and Coding Conventions for ActionScript 2.0 > ActionScript coding conventions > Structuring a class file | |||
You create classes in separate ActionScript 2.0 files that are imported into a SWF file when it is compiled.
You create classes in separate ActionScript 2.0 files that are imported into a SWF file when you compile an application. To create a class file, you write code that can have a certain methodology and ordering. This methodology is discussed in the following sections.
The following conventions for structuring a class file show how you can order parts of a class to increase the efficiency and improve the readability of your code.
To structure a class file, use the following elements:UserClass{...}
In this comment, add information that is pertinent for the entire class or interface.
Write the public class variables first and follow them with private class variables.
Write the public member variables first, and follow them with private member variables.
public function UserClass(username:String, password:String) {...}
Group methods by their functionality, not by their accessibility or scope. Organizing methods this way helps to improve the readability and clarity of your code.
|
|
|
|