How to duplicate an Array with out binding it to the original?


var array1:Array;
var array2:Array;

testArray(new Array(1,2,3));

function testArray(e:Array):void{
    array1 = e;
    array2 = e;
    
    array1[0] = 4;
    trace(array2[0]); // outputs 4 but should be 1
}

this is a binding problem that I can’t figure out.
I have tried to make a new array before “array1 = e” but it just overrides the old array with the new one and not copying it but binding it to the original array.

help me please I have a job to finish tonight :worried: