Problem with 2 dimensional array in flashMX

Hi guys, I have tried to creatre a 2 dimensional array and it doesn’t seems to work somehow. Everytime I run this code, my program crashes. The code is as stated below:

var board = new Array();

for ( i = -6; i <= 12; i++ )
{
for ( j = -7; j <= 14; i++ )
{
if ( i >= 0 && i <= 6 && j >= 0 && j <= 7 )
board*[j] = false;
else
board*[j] = true;
}
}

So, can anyone help? :slight_smile:

change:

[AS]
for ( i = -6; i <= 12; i++ )
{
for ( j = -7; j <= 14; i++ )
{
if ( i >= 0 && i <= 6 && j >= 0 && j <= 7 )
board*[j] = false;
else
board*[j] = true;
}
}
[/AS]

to:

[AS]
for ( i = -6; i <= 12; i++ )
{
for ( j = -7; j <= 14; j++ )
{
if ( i >= 0 && i <= 6 && j >= 0 && j <= 7 )
board*[j] = false;
else
board*[j] = true;
}
}

[/AS]

look at the different :slight_smile:

bad: for ( j = -7; j <= 14; i++ )
good: for ( j = -7; j <= 14; j++ )

now it works fine

Oh, ok. It’s just a typo. Silly me. Thanks anyway.