About data types 35
To include a quotation mark in a string, precede it with a backslash character (\). This is called
escaping a character. There are other characters that cannot be represented in ActionScript except
by special escape sequences. The following table provides all the ActionScript escape characters:
Number
The number data type is a double-precision floating-point number. You can manipulate numbers
using the arithmetic operators addition (
+), subtraction (-), multiplication (*), division (/),
modulo (
%), increment (++), and decrement (--). You can also use methods of the built-in Math
and Number classes to manipulate numbers. The following example uses the
sqrt() (square
root) method to return the square root of the number 100:
Math.sqrt(100);
For more information, see “Numeric operators” on page 45.
Boolean
A Boolean value is one that is either
true or false. ActionScript also converts the values true
and
false to 1 and 0 when appropriate. Boolean values are most often used with logical
operators in ActionScript statements that make comparisons to control the flow of a script. For
example, in the following script, the SWF file plays if the variable
password is true:
onClipEvent(enterFrame) {
if (userName == true && password == true){
play();
}
}
See “Using built-in functions” on page 51 and “Logical operators” on page 47.
Escape sequence Character
\b
Backspace character (ASCII 8)
\f
Form-feed character (ASCII 12)
\n
Line-feed character (ASCII 10)
\r
Carriage return character (ASCII 13)
\t
Tab character (ASCII 9)
\"
Double quotation mark
\'
Single quotation mark
\\
Backslash
\000 - \377
A byte specified in octal
\x00 - \xFF
A byte specified in hexadecimal
\u0000 - \uFFFF
A 16-bit Unicode character specified in hexadecimal