I'm not even sure what to call this. I tried to create a contrived example, but it won't work =/ (or rather it does)
So here's the setup. I have my document class, which has a member variable (call it A) which is a custom class. The varable has a public property (call it B) which is an array of arrays (contains 3). Inside of the document class, I have a function which assigns one of the arrays to a variable (call it C), then uses it and later assigned B to an array of nulls. The problem is that when I do this assignment, it also modifies the array inside of A.
example (but as I mentioned, I couldnt create a broken contrived example)
A.B = [[1,2,3],[4,5,6],[7,8,9]];
C = A.B;
trace(A.B, C); // 1,2,3,4,5,6,7,8,9 4,5,6
C = [null,null,null];
trace(A.B, C); // 1,2,3,null,null,null,7,8,9 null,null,null
No matter what I try, C seems to be "linked" to the array inside A.B. I have tried it with both the shortcut and full syntax of Array(); The only solution I could get to work was to create a getB function on A which accepts the index, loop over the contents of A.B[i] assigning the values to a new variable D which is then returned. This seems overkill.
I have been noticing similar behavior, so any general assistance would be very helpfull as well. Even knowing what this is called so I can google for it effectively would be helpful!
Europe, Middle East and Africa