In ActionScript 3.0,every object is defined by a class.A class can be thought of as a template or a blueprint for a type of object.
Class definitions can include variables and constants,whichhold data values,and methods,which are functions that encapsulate behavior bound to the Class
The values stored in properties can be primitive values or other objects.Primitive valuesare numbers,strings,or Boolean values.
ActionScript 3.0,however,introduces the concept of untyped variables,which can be
designated in the following two ways:
An untyped variable is not the same as a variable of type Object.The key difference is thatuntyped variables can hold the special value undefined ,while a variable of type Object cannot hold that value.
The scope of a variable is the area of your code where the variable can be accessed by a lexical
A global variable is one that is defined in all areas of your code,whereas a local
variable is one that is defined in only one part of your code.
In ActionScript 3.0,variables are always scoped to the function or class in which they are declared.
A global variable is a variable that you define outside of any function or class definition.
For example,the following code creates a global variable strGlobal by declaring it outside of any function.
The example shows that a global variable is available both inside and outside the function definition.
var strGlobal:String ="Global";
function scopeTest ()
You declare a local variable by declaring the variable inside a function definition.
The smallest area of code for which you can define a local variable is a function definition.
A local variable declared within a function will exist only in that function.For example,if you declare a variable named str2 within a function named localScope(),that variable will not be available outside the function.