About using the this keyword in classes

Use the this keyword as a prefix within your classes for methods and member variables. Although it is not necessary, the this keyword makes it easy to tell that a property or method belongs to a class when it has a prefix; without the keyword, you cannot tell whether 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, which makes code readable. Depending on the coding environment you use, adding prefixes might also trigger code hints.

NOTE

 

You do not have to add these prefixes, and some developers feel it is unnecessary. Adobe recommends adding the this keyword as a prefix, because it can aid readability and helps you write clean code by providing context for your methods and variables.


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00000788.html