PDA

View Full Version : Merge



fw2803
November 10th, 2007, 05:44 AM
Hi there

How can I merge three or more arrays into one?

Something like this?


array0 = array1.concat(array2,array3,array4)


Thanks

Lou
November 15th, 2007, 11:23 PM
Hi there

How can I merge three or more arrays into one?

Something like this?
ActionScript Code:

array0 = array1.concat(array2,array3,array4)




Thanks
Yes

fw2803
November 17th, 2007, 01:08 AM
Weird... I got an error... I'll check it out a bit...

Lou
November 20th, 2007, 05:06 AM
Weird... I got an error... I'll check it out a bit...

hmm worked for me

ActionScript Code:

fruit = [" Fruits: ", "apple", "orange", "pear", "grape"];
shape = [" Shapes: ", "square", "triangle", "circle"];
colors = [" Colors: ", "red", "green", "purple", "indigo"];
animal = [" Animals: ", "penguin", "cat", "horse", "monkey"];

combined_arrays = fruit.concat(shape,colors,animal)

trace(combined_arrays)