maybe you’ve to make first the arrays then push something…
this is not tested and maybe you’ve to add it a little different but i hope it works…
newmap = new Array();
for (i=0;i<map_height;i++) {
var new_array = new Array();
newmap.push(new_array);
for (j=0;j<map_width;j++) {
var new_array2 = new Array();
newmap*.push(new_array2);
old_label = oldmap*[j][0];
old_type = oldmap*[j][1];
// transform the data
new_label = transformLabel(old_label);
new_type = transformType(old_type);
state = [new_label,new_type];
// THIS LINE IS NOT WORKING
newmap*[j].push(state);
Exactly. In order to use the push () method, you have to tell Flash that newmap’s elements are arrays as well. Pieter’s code is probably correct, but I think that this is enough:
[font=Courier New]newmap = new Array();[/font]
[font=Courier New]for (i=0;i<map_height;i++) { [/font]
** newmap* = [] ;**
[font=Courier New]for (j=0;j<map_width;j++) {[/font]
[font=Courier New] var old_label = oldmap*[j][0];[/font]
[font=Courier New] var old_type = oldmap*[j][1];[/font]
[font=Courier New] // transform the data[/font]
[font=Courier New] var new_label = transformLabel(old_label);[/font]
[font=Courier New] var new_type = transformType(old_type);[/font]
[font=Courier New] var state = [new_label,new_type];[/font]
[font=Courier New] // THIS LINE IS NOT WORKING[/font]
[font=Courier New] newmap*[j].push(state);[/font]
[font=Courier New]} // end j [/font]
[font=Courier New]} // end i[/font]
[font=Courier New]trace(newmap);[/font]