View Full Version : Problem with 2 dimensional array in flashMX
silverType
March 10th, 2003, 09:11 PM
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[i][j] = false;
else
board[i][j] = true;
}
}
So, can anyone help? :)
RvGaTe
March 11th, 2003, 05:28 PM
change:
for ( i = -6; i <= 12; i++ )
{
for ( j = -7; j <= 14; i++ )
{
if ( i >= 0 && i <= 6 && j >= 0 && j <= 7 )
board[i][j] = false;
else
board[i][j] = true;
}
}
to:
for ( i = -6; i <= 12; i++ )
{
for ( j = -7; j <= 14; j++ )
{
if ( i >= 0 && i <= 6 && j >= 0 && j <= 7 )
board[i][j] = false;
else
board[i][j] = true;
}
}
look at the different :)
bad: for ( j = -7; j <= 14; i++ )
good: for ( j = -7; j <= 14; j++ )
now it works fine
silverType
March 13th, 2003, 10:14 AM
Oh, ok. It's just a typo. Silly me. Thanks anyway.
ammu
December 22nd, 2005, 01:32 AM
quotes = new Array();
for (i=0; i<=1; i++) {
for (j=0; j<=1; j++) {
quotes[i][j] = "Flash is cool!";
}
}
for (i=0; i<=1; i++) {
for (j=0; j<=1; j++) {
trace(quotes[i][j]);
}
}
here no answer please help me what is the problem in it.
silverType
December 22nd, 2005, 06:57 AM
try this:
quotes = new Array();
for (i=0; i<=1; i++) {
//add in this line
quotes[i] = new Array();
for (j=0; j<=1; j++) {
quotes[i][j] = "Flash is cool!";
}
}
Hope this helps.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.