Naming conventions
739
Naming functions and methods
Use the following guidelines when you name functions and methods in your code. For
information on writing functions and methods, see
Chapter 6, “Functions and Methods.”
■
Use descriptive names.
■
Use mixed case for concatenated words.
A good example would be
singLoud()
.
■
Start function and method names with a lowercase letter.
■
Describe what value is being returned in the function’s name.
For example, if you are returning the name of a song title, you might name the function
getCurrentSong()
.
■
Establish a naming standard for relating similar functions.
ActionScript 2.0 does not permit overloading. In the context of object-oriented
programming,
overloading
refers to the ability to make your functions behave differently
depending on which data types are passed into them.
■
Name methods as verbs.
You might concatenate the name, but it should contain a verb. You use verbs for most
methods because they perform an operation on an object.
Examples of method names include the following:
sing();
boogie();
singLoud();
danceFast();
Naming classes and objects
When you create a new class file, use the following guidelines when you name the class and
ActionScript file. For proper formatting, see the following examples of class names:
class Widget;
class PlasticWidget;
class StreamingVideo;
You might have public and private member variables in a class. The class can contain variables
that you do not want users to set or access directly. Make these variables private and allow
users to access the values only by using getter/setter methods.
Summary of Contents for FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Page 1: ...Learning ActionScript 2 0 in Flash...
Page 8: ...8 Contents...
Page 18: ...18 Introduction...
Page 30: ...30 What s New in Flash 8 ActionScript...
Page 66: ...66 Writing and Editing ActionScript 2 0...
Page 328: ...328 Interfaces...
Page 350: ...350 Handling Events...
Page 590: ...590 Creating Interaction with ActionScript...
Page 710: ...710 Understanding Security...
Page 730: ...730 Debugging Applications...
Page 780: ...780 Deprecated Flash 4 operators...
Page 830: ...830 Index...