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
Содержание FLASH MX 2004 - ACTIONSCRIPT
Страница 1: ...ActionScript Reference Guide...
Страница 8: ...8 Contents...
Страница 12: ......
Страница 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Страница 54: ...54 Chapter 2 ActionScript Basics...
Страница 80: ...80 Chapter 3 Writing and Debugging Scripts...
Страница 82: ......
Страница 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Страница 112: ......
Страница 120: ...120 Chapter 6 Using the Built In Classes...
Страница 176: ......
Страница 192: ...192 Chapter 10 Working with External Data...
Страница 202: ...202 Chapter 11 Working with External Media...
Страница 204: ......
Страница 782: ...782 Chapter 12 ActionScript Dictionary...
Страница 793: ...Other keys 793 221 222 Key Key code...
Страница 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Страница 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Страница 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Страница 816: ...816 Index...