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

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

Don't overuse getter/setter functions in your class file.
Getter/setter functions are excellent for a variety of purposes (see
methods" on page
your application's architecture or organization.
Set most member variables to private unless you have a good reason for making them
public.
From a design standpoint, it is much better to make member variables private and allow
access to those variables through a group of getter/setter functions only.
Using the this prefix in class files
Use the
keyword as a prefix within your classes for methods and member variables.
this
Although it is not necessary, it makes it easy to tell that a property or method belongs to a
class when it has a prefix; without it, you cannot tell if the property or method belongs to the
superclass.
You can also use a class name prefix for static variables and methods, even within a class. This
helps qualify the references you make. Qualifying references makes for readable code.
Depending on what coding environment you are using, your prefixes might also trigger code
completion and hinting. The following code demonstrates prefixing a static property with a
class name:
class Widget {
public static var widgetCount:Number = 0;
public function Widget() {
Widget.widgetCount++;
}
}
You don't have to add these prefixes, and some developers feel it is unnecessary.
Macromedia recommends that you add the
improve readability and it helps you write clean code by providing context.
255), however overuse might indicate that you could improve upon
"About getter and setter
keyword as a prefix, because it can
this
ActionScript coding conventions
753

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