Different data types are available in ActionScript to be used for variables created by the programmer. Some of the data types that are used are classified as fundamental data types. The major two data types that are found in Flash ActionScript are the String and Numeric data type. Now let us discuss these data types in more detail.
String: The String data type represents a textual value, like a name
of a person. A few examples of the string data type are as follows:
• "Adobe "
• "Let us learn Action Scripts"
• "1200"
Numeric: In ActionScript the numeric data type mainly consists of four specific data types which are number, int, Dint and Boolean. Now we'll discuss these data types in more detail.
Number: The number data type represents a numeric value which may include both integers (whole numbers) or floating point (numbers including a decimal part).
Eg: 123, 9.537 etc
lnt: The integer data type which is a whole number without any decimal part
Eg: 86, -28 etc
Uint: The Dint data type is related to an unsigned integer which denotes a whole number that cannot be negative
Eg: 100, 46 etc
Boolean: This data type has two values: true or false.
In ActionScript, simple data types represent a single piece of information: these may be a single number or a single sequence of text but it is to be noted that the majority of the data types defined in ActionScript can be described as complex data types as they rep¬resent a set of values which are grouped together. For instance, if we consider a variable having a data type such as Date, it will hold a single value.
Though 'date' is considered as a single value by declaring and creating a Date variable, internally the computer will consider it as a group of several values that, put together, define a single date. Most of the built-in data types that are found in Flash Action script are basically complex data types. Some of the most impor¬tant complex data types that are found in ActionScript include:
MovieClip: This data type is related to the clip symbol.
TextField: The TextFileld data type is frequently used in ActionScript which is a dynamic and input text field. SimpleButton: This data type is related to a button symbol.
Date: The Date data type gives suitable and relevant information about a single moment in time.
Another two prominent and frequently used words that are used as synonyms for data types are the 'class' and 'object'. A class is basically used when we define a data type. On the other hand, an object is defined as the instance of the class. Let us take an example where the same thing has been expressed in three different ways.
The data type of the variable myName is a Number.
The variable myName is a Number instance.
The variable myName is a Number object.
The variable myName is an instance of the Number class.
It is to be noted that variables in flash have the capacity t accept any type of data at any time even if the variable earlier ha a numeric value. It is also possible to overwrite a different dat type. For instance:
var myName; myName = "Jack";
![]()



Reply With Quote
Copyright Techfuels
Bookmarks