Instance names
You use the Property inspector to assign instance names to instances on the Stage. For example, a
master symbol in the library could be called
the SWF file could have the instance names
following code sets a variable called
instance names:
_root.scorePlayer1_mc.score += 1;
_root.scorePlayer2_mc.score -= 1;
You can use special suffixes when naming instances so that code hints (see
on page
63) appear as you type your code. For more information, see
code hints" on page
Keywords
are reserved words that have special meaning. For example,
declare local variables. You cannot use a keyword as an identifier. For example,
variable name. For a list of keywords, see
Methods
are functions associated with a class. For example,
method associated with the MovieClip class. You can also create functions that act as methods,
either for objects based on built-in classes or for objects based on classes that you create. For
example, in the following code,
have previously defined:
function reset(){
this.x_pos = 0;
this.x_pos = 0;
}
controller.clear = reset;
controller.clear();
Objects
are collections of properties and methods; each object has its own name and is an
instance of a particular class. Built-in objects are predefined in the ActionScript language. For
example, the built-in Date object provides information from the system clock.
Operators
are terms that calculate a new value from one or more values. For example, the
addition (
) operator adds two or more values together to produce a new value. The values that
+
operators manipulate are called operands.
Parameters
(also called arguments) are placeholders that let you pass values to functions.
For example, the following
and
firstName
function welcome(firstName, hobby) {
welcomeText = "Hello, " + firstName + "I see you enjoy " + hobby;
}
Packages
are directories that contain one or more class files, and reside in a designated classpath
directory (see
"Understanding the classpath" on page
Properties
are attributes that define an object. For example,
clips that defines whether a movie clip is visible or hidden.
28
Chapter 2: ActionScript Basics
are unique names that let you target movie clip and button instances in scripts.
score
62.
clear()
welcome()
:
hobby
and the two instances of that symbol in
counter
scorePlayer1_mc
inside each movie clip instance by using
"Keywords" on page
getBytesLoaded()
becomes a method of a
function uses two values it receives in the parameters
169).
_visible
and
scorePlayer2_mc
"Using code hints"
"Using suffixes to trigger
is a keyword used to
var
is not a legal
var
33.
is a built-in
object that you
controller
is a property of all movie
. The
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?
Questions and answers