12
Chapter 1: ActionScript Basics
Identifiers
are names used to indicate a variable, property, object, function, or method. The first
character must be a letter, underscore (
_
), or dollar sign (
$
). Each subsequent character must be a
letter, number, underscore, or dollar sign. For example,
firstName
is the name of a variable.
Instances
are objects that contain all the properties and methods of a particular class. For
example, all arrays are instances of the Array class, so you can use any of the methods or properties
of the Array class with any array instance.
Instance names
are unique names that let you target instances you create. For example, in the
following code, “names” and “studentName” are instance names for two objects, an array and a
string:
var names:Array = new Array();
var studentName:String = new String();
Keywords
are reserved words that have special meaning. For example,
var
is a keyword used to
declare local variables. You cannot use a keyword as an identifier. For example,
var
is not a legal
variable name. For a list of keywords, see
“Keywords and reserved words” on page 17
.
Methods
are functions associated with a class. For example,
sortOn()
is a built-in method
associated with the Array 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,
clear()
becomes a method of a
controller
object that you have previously
defined:
function reset(){
this.x_pos = 0;
this.y_pos = 0;
}
controller.clear = reset;
controller.clear();
The following examples show how you create methods of a class:
//ActionScript 1 example
A = new Object();
A.prototype.myMethod = function() {
trace("myMethod");
}
//ActionScript 2 example
class B {
function myMethod() {
trace("myMethod");
}
}
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 class 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
.
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...