EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 224

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
224 Functions and Methods
When you use this ActionScript, you are calling the eatCabbage() method of the
EatingHabits class.
6. After the previous line of ActionScript, add the following code:
function eatCarrots():Void {
trace("tastes good");
}
eatCarrots();
In this code, you write and call the eatCarrots() function.
7. Select Control > Test Movie to test the SWF file.
Naming methods
You should use verbs to name methods, and words with mixed cases for concatenated words,
making sure that the first letter is lowercase. For example, you might name methods in the
following ways:
sing();
boogie();
singLoud();
danceFast();
You use verbs for most method names because methods perform an operation on an object. As
with variables, you cannot use special characters, and the method name cannot start with a
number. For more information, see “Naming conventions” on page 732.
NOTE
When you use methods of any built-in class (in addition to the custom class you
wrote earlier in this procedure), you are using a method on a timeline.

Table of Contents

Related product manuals