ActionScript Passing Variable by Value on Reference

It took me hours to figure our why this was returning the wrong value

// CODE Sample

function one(){
var test1 = Array();
test1[“one”] = 1;

var test2 = test1

trace(**test2**.one); // output = 1  // this make sense because it gets the value from **test1**
**test1**.one = 1000;

trace(**test2**.one); // output = 1000        // !!!! this should be 1

}

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