Syntax Flashcards
can be thought of as a template or a blueprint for a type of object.
class
can include variables and constants, which hold data values, and methods, which are functions that encapsulate behavior bound to the class.
class definitions
The values stored in properties can be_or other objects.
These are numbers, strings, or Boolean values.
primitive values
contains a number of built-in classes that are part of the core language
ActionScript 3.0
All classes, whether built-in or user-defined, derive from the _ class
Object
Object data type is no longer the _ , even though all other classes still derive from it.
default data type
In ActionScript 2.0, the following two lines of code were equivalent because the lack of a type annotation meant that a variable would be of type Object:
var someObj:Object;
var someObj;
ActionScript 3.0, however, introduces the concept of untyped variables, which can be designated in the following two ways:
var someObj:*;
var someObj;
allow you to store values that you use in your program
Variables
To declare a variable, you must use the _ with the variable name.
var statement
the following line of ActionScript declares a variable named i:
var i;
Declaring a variable without designating the variable’s type is legal, but generates a compiler warning in _.
strict mode
You designate a variable’s type by appending the variable name with a _, followed by the variable’s type
colon (:)
the following code declares a variable i that is of type int:
var i:int;
You can assign a value to a variable using the assignment _.
operator (=)
the following code declares a variable i and assigns the value 20 to it:
var i:int; i = 20;
(or if more convenient)
var i:int = 20;
The technique of assigning a value to a variable at the time it is declared is commonly used not only when assigning primitive values such as integers and strings, but also when creating an _ or instantiating an instance of a class.
array
The following example shows an array that is declared and assigned a value using one line of code
var numArray:Array = [“zero”, “one”, “two”];
You can create an instance of a class by using the _ operator
new
The following example creates an instance of a class named Custom Class, and assigns a reference to the newly created class instance to the variable named custom Item:
var customItem:CustomClass = new CustomClass();
If you have more than one variable to declare, you can declare them all on one line of code by using the _ to separate the variables
comma operator (,)
the following code declares three variables on one line of code
var a:int, b:int, c:int;
the following code declares three variables (a, b, and c) and assigns each a value
var a:int = 10, b:int = 20, c:int = 30;
is the area of your code where the variable can be accessed by a lexical reference.
scope of a variable
variable that is defined in all areas of your code; a variable that you define outside of any function or class definition.
global variable
variable that is defined in only one part of your code
local variable
You declare a local variable by declaring the variable inside a _ - the smallest area of code for which you can define a local variable.
function definition
The primitive data types include Boolean, int, Null, Number, String, uint, and void. The ActionScript core classes also define the following complex data types: Object, Array, Date, Error, Function, RegExp, XML, and XMLList.
Data Type Descriptions
data type includes two values: true and false.
Boolean data type
default value of a Boolean variable that has been declared but not initialized
false
stored internally as a 32-bit integer and includes the set of integers from -2,147,483,648 (-231) to 2,147,483,647 (231- 1), inclusive.
int data type
Previous versions of ActionScript offered only the _, which was used for both integers and floating-point numbers
Number data type
The default value for variables that are of the data type int
0
This is the default value for the String data type and all classes that define complex data types, including the Object class
null
can represent integers, unsigned integers, and floating-point numbers
Number data type
To store a floating-point number, include a _ in the number.
decimal point
This standard dictates how floating-point numbers are stored using the 64 available bits
IEEE Standard for Binary Floating-Point Arithmetic (IEEE-754)
In a 64- bit, one bit is used to designate whether the number is _
positive or negative
In a 64-bit, eleven bits are used for the _, which is stored as base 2
exponent
In a 64-bit, the remaining 52 bits are used to store the_, which is the number that is raised to the power indicated by the exponent.
significand(also called themantissa)
is stored internally as a 32-bit unsigned integer and includes the set of integers from 0 to 4,294,967,295 (2^32 - 1), inclusive
uint data type
Use the uint data type for special circumstances that call for _
non-negative integers
The default value for variables that are of data type uint
0
The void data type contains only one value, _
undefined
In previous versions of ActionScript, _ was the default value for instances of the Object class
undefined
are variables that either lack any type annotation, or use the asterisk (*) symbol for type annotation
Untyped Variables
The _ is defined by the Object class
Object data type
serves as the base class for all class definitions in ActionScript.
Object Class
The following example shows two equivalent statements, both of which declare an untyped variable x
var x
var x:*