String data type
A string is a sequence of characters such as letters, numbers, and punctuation marks. You enter
strings in an ActionScript statement by enclosing them in single (') or double (") quotation
marks.
A common way that you use the string type is to assign a string to a variable. For example, in the
following statement,
var favoriteBand_str:String = "L7";
You can use the addition (+) operator to concatenate, or join, two strings. ActionScript treats
spaces at the beginning or end of a string as a literal part of the string. The following expression
includes a space after the comma:
var greeting_str:String = "Welcome, " + firstName;
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:
Escape sequence
\b
\f
\n
\r
\t
\"
\'
\\
\000 - \377
\x00 - \xFF
\u0000 - \uFFFF
Strings in ActionScript are immutable, the same as Java. Any operation that modifies a string
returns a new string.
The String class is a built-in ActionScript class.
Number data type
The number data type is a double-precision floating-point number. The minimum value of a
number object is approximately 5e-324. The maximum is approximately 1.79E+308.
You can manipulate numbers using the arithmetic operators addition (
multiplication (
*
information, see
is a string assigned to the variable
"L7"
Character
Backspace character (ASCII 8)
Form-feed character (ASCII 12)
Line-feed character (ASCII 10)
Carriage return character (ASCII 13)
Tab character (ASCII 9)
Double quotation mark
Single quotation mark
Backslash
A byte specified in octal
A byte specified in hexadecimal
A 16-bit Unicode character specified in hexadecimal
), division (
), modulo (
/
"Numeric operators" on page
favoriteBand_str
), increment (
), and decrement (
%
++
33.
:
), subtraction (-),
+
). For more
--
About data types
19
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?