[Flash8] Actionscript - passing array variables by Value not Reference

It took me hours to figure our why this was returning the wrong value - when assigning one array to another it passes by reference not Value. I need a way to force it to pass by values. e.g. copy the existing array and have the second array reference it, so i am free to modify the first array without changing the values of the second

// CODE Sample - show that array assignment = passing by reference.

function one(){

[COLOR=Blue] var[/COLOR] test1 = [COLOR=Blue]Array/COLOR;
test1[[COLOR=Green]“one”[/COLOR]] = [COLOR=Red]1[/COLOR];

[COLOR=Blue] var[/COLOR] test2 = test1;

[COLOR=Blue] trace/COLOR; // output = 1 // this make sense because it gets the value from* test1***
test1.one = [COLOR=Red]1000[/COLOR];

 [COLOR=Blue]trace[/COLOR](**test2**.one); *// output = 1000        // !!!! this should be 1 === passed by reference. If by value this would be independent from test1.one*

}

one();

/// end CODE SAMPLE

From the example above You see that in Actionscript when assigning one variable to another it does it my reference not value. So when you chage the value of one array it changes the value of the other automatically.

I need to have the “test2” variable reference the “test1” array only by value so if modify “test1” the values of “test2” won’t be modified.

If this is a setting to change this or a way to have the variable reference only by value this would be extremely helpful.

Thanks

KJ