ProblemYou want to convert an array to a string. SolutionUse the join( ) method. DiscussionActionScript provides you with a built-in way to quickly convert arrays to strings (assuming, of course, that the array elements themselves are either strings or another datatype that ActionScript can automatically cast to a string) using the join( ) method. You should pass the join( ) method a string that tells Flash which delimiter to use to join the elements: var letters:Array = ["a", "b", "c"]; trace(letters.join("|")); // Displays: a|b|c If you don't provide a delimiter, Flash uses a comma by default: var letters:Array = ["a", "b", "c"]; trace(letters.join()); // Displays: a,b,c
See AlsoRecipe 5.6 |