Adobe Flash Professional CS6 Adobe Flash Professional CS6 Classroom In A Book | Page 227
If you’ve used scripting languages before, the documentation included in the Flash
Help menu may provide additional guidance you need to use ActionScript profi-
ciently. If you’re new to scripting and want to learn ActionScript, you may find an
ActionScript 3.0 book for beginners helpful.
Understanding scripting terminology
Many of the terms used in describing ActionScript are similar to terms used for
other scripting languages. The following terms are used frequently in ActionScript
documentation.
variable
P Note: Variable
names must be unique,
and they are case-
sensitive. The variable
mypassword is not the
same as the variable
MyPassword. Variable
names can contain
only numbers, letters,
and underscores; they
cannot begin with a
number. These are the
same naming rules
that apply to instances.
(In fact, variables
and instances are
conceptually the same.)
A variable represents a specific piece of data that may or may not be constant.
When you create, or declare, a variable, you also assign a data type, which deter-
mines what kind of data the variable can represent. For example, a String variable
holds any string of alphanumeric characters, whereas a Number variable must
contain a number.
Keyword
In ActionScript, a keyword is a reserved word that is used to perform a specific
task. For example, var is a keyword that is used to create a variable.
You can find a complete list of keywords in Flash Help. Because these words are
reserved, you can’t use them as variable names or in other ways. ActionScript
always uses them to perform their assigned tasks. As you enter ActionScript in the
Actions panel, keywords will turn a different color. This is a great way to know if a
word is reserved by Flash.
arguments
Arguments provide specific details for a particular command and are the values
between parentheses () in a line of code. For example, in the code gotoAndPlay(3);
the argument instructs the script to go to frame 3.
Function
A function is a group of statements that you can refer to by name. Using a function
makes it possible to run the same set of statements without having to type them
repeatedly.
objects
In ActionScript 3.0, you work with objects, which are abstract types of data
that help you do certain tasks. A Sound object, for example, helps you control
sound, and a Date object can help you manipulate time-related data. The button
symbols that you created earlier in this lesson are also objects—they are called
SimpleButton objects.
218
Lesson 6
Creating Interactive navigation