So I'm trying to push values from my equipz array to inventory array, and then replacing equipz values with 0's. But for some reason inventory's values are also replaced with 0's and I am just not sure why. I feel it might be because of the push() method but I am still unsure. I don't think that should be an issue because I feel they are unrelated arrays. Any help would be appreciated, maybe there is a better way to do this so I could avoid this all together. Thanks.
Here's the code I'm using.
var inventory:Array = new Array()
var equipz:Array = new Array(
new Array("Brittle Sword","Weapon",1,10,5,1,1,1,4,1,0,"desc",0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0),
new Array(0,0,0,0,0,0,0,0,0,0,0,0,0))
if(var == 1){
_root.inventory.push(_root.equipz[0])
var = 2
trace(_root.inventory+"new array value")
}
if(var == 2){
for(i = 0;i < equipz[0].length; i ++){
_root.equipz[0][i] = 0
if(i == equipz[0].length - 1){
var = 3;trace(_root.inventory+"inventory altered array value)
}
}
}