Array duplicate error

Hey all,

I am making tetris and found an incredibly annoying bug (in Flash 5 AS).


  array1 = new Array('0','1','2','3');
  array2 = array1;
  array2[0] = 'blah';
  trace(array1[0]);

Now, this traces out ‘blah’. It’s supposed to trace ‘0’. I copied array2 from array1, but if I change array2, array 1 will change also. How is this possible? This is not so with variables (strings, integers), but with arrays. Is this an error or something? How can I avoid this?