EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 277

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Array.join() 277
Array.join()
Availability
Flash Player 5.
Usage
my_array.join([separator])
Parameters
separator
A character or string that separates array elements in the returned string. If you omit
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
join() method.
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

Table of Contents

Related product manuals