I'm not familiar with working with an ActionScript array assignment by reference methodology. I understand what he is doing, but for some reason I am embarrassed to manage many arrays using this methodology. Is there an easy way to work with ActionScript arrays where array assignment is done using VALUE rather than REFERENCE? For example, if I want to assign oneArray to twoArray without binding two arrays to each other forever in the future, how can I do this? Will this work?
var oneArray:Array = new Array("a", "b", "c"); var twoArray:Array(3); for (ii=0; ii<3; ii++) { twoArray[ii] = oneArray[ii]; }
The goal is to be able to modify twoArray without seeing the change in oneArray .
Any advice on how to assign arrays of VALUE instead of REFERENCE?
---- for reference ----
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Array.html
Array assignment is done by reference, not by value. When you assign one array variable to another array variable, both refer to the same array:
var oneArray:Array = new Array("a", "b", "c"); var twoArray:Array = oneArray;
ggkmath
source share