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
.
NO
TE
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.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...