Types of Data Types


Before we get into any major details about any of the data types, let's briefly look at a few of the different data types in Flash:

  • String. Any piece of data to be listed as basic text (for example, "This is a string data type"). Notice the quotation marks, which signify that this is a string.

  • Number. Any piece of data to be listed as an integer, or floating-point with a numeric value (for example, 1, 44, -10, 21.7, and -0.8 are all legal number data types).

  • Boolean. This is a logical representation used for conditions and results of certain functions (TRue and false are the only two Boolean data types).

  • Null. This data type is used to show the absence of data or having a value of null.

  • Undefined. This data type is used to show the absence of value in a variable; its value is undefined.

  • Array. This is used for lists of data (it is its own data type); the data itself can be any type such as String, or Number, or it can also be mixed within the array.

The two most commonly used data types are strings and numbers. We will go into greater detail on these two and discuss the different parts of both data types.

First, let's take a look at these data types and see how easily they can be misinterpreted:

 "My name is David."      // this is a string datatype 1234                     // this is a number datatype "1234"                   // this is a string datatype 1+2+3                    // this is an expression that evaluates to a number datatype "My name "+"is David"    // this is an expression that evaluates to a string datatype 'Single quote marks'     // this is a string datatype with single quote marks 

These are the basic forms of the string and number data types. The text to the right with the double forward slashes (//) just represents comments in the code (as mentioned in the previous chapter, the interpreter skips comments completely).




Macromedia Flash Professional 8 Unleashed
Macromedia Flash Professional 8 Unleashed
ISBN: 0672327619
EAN: 2147483647
Year: 2005
Pages: 319

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net