MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 751

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

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:
1.
Add documentation comments that include a general description of the code, in addition
to author information and version information.
2.
Add your import statements (if applicable).
3.
Write a class declaration, or interface declaration, such as the following:
UserClass{...}
4.
Include any necessary class or interface implementation comments.
In this comment, add information that is pertinent for the entire class or interface.
5.
Add all your static variables.
Write the public class variables first and follow them with private class variables.
6.
Add instance variables.
Write the public member variables first, and follow them with private member variables.
7.
Add the constructor statement, such as the one in the following example:
public function UserClass(username:String, password:String) {...}
8.
Write your methods.
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.
9.
Write the getter/setter methods into the class file.
ActionScript coding conventions
751

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents