String()
Availability
Flash Player 4; behavior changed in Flash Player 7.
Usage
String(expression)
Parameters
An expression to convert to a string.
expression
Returns
A string.
Description
Function; returns a string representation of the specified parameter, as described in the following
list:
•
If
expression
•
If
expression
•
If
expression
by calling the string property for the object or by calling
property exists.
If
is
expression
•
If
expression
•
If
expression
notation.
Note: Slash notation is not supported in Flex applications.
Example
In the following example, you use ActionScript to convert specified expressions to a string:
var string1:String = String("3");
var string2:String = String("9");
trace(string1+string2);
Because both parameters are strings, the values are concatenated rather than added.
See also
Number.toString(), Object.toString(),
208
Chapter 5: ActionScript Core Language Elements
ActionScript Core Language Elements
is a number, the return string is a text representation of the number.
is a string, the return string is
is an object, the return value is a string representation of the object generated
, the return value is
undefined
is a Boolean value, the return string is
is a movie clip, the return value is the target path of the movie clip in slash (/)
// output: 39
.
expression
Object.toString()
.
undefined
or
"true"
"false"
String
class,
" " (string delimiter)
CHAPTER 5
if no such
.
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?