Trouble updating an entry in a matrix
I am new in AS3, so please excuse a possibley easy question.
I want to update one entry in a matrix M. I use the commonsensical M[row][column]=1. It however has unexpected results:
The code is the following:
var m:Array = new Array()
var n:Array= new Array()
for (var i=0;i<3;i++) {
n.push(0);
}
for (var j=0;j<3;j++) {
m.push(n);
}
trace(m);
m[2][2]=34;
trace(m);
In the obtained matrix, more than one entry is updated and I obtain the following:
0,0,34,0,0,34,0,0,34
Any help?. Thanks
