Array.join()
Availability
Flash Player 5.
Usage
my_array.join([separator])
Parameters
A character or string that separates array elements in the returned string. If you omit
separator
this parameter, a comma is used as the default separator.
Returns
String.
Description
Method; converts the elements in an array to strings, inserts the specified separator between the
elements, concatenates them, and returns the resulting string. A nested array is always separated
by a comma, not by the separator passed to the
Example
The following example creates an array with three elements: Earth, Moon, and Sun. It then joins
the array three times—first using the default separator (a comma and a space), then using a dash,
and then using a plus sign (+)—and displays them in the Output panel:
a_array = new Array("Earth","Moon","Sun")
trace(a_array.join());
// returns Earth, Moon, Sun
trace(a_array.join(" - "));
// returns Earth - Moon - Sun
trace(a_array.join(" + "));
// returns Earth + Moon + Sun
method.
join()
Array.join()
277
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?
Questions and answers