First of all hi to everybody glad to find such a vibrant AS forum (-:
I’m not sure if i can explain what i want to do very well but i’ll try my hardest so please bear with me So i’m running a simple nested for loop (code below) that when you go over a tile makes it change its color, so far so good but i also want to make it so that when you go over a tile you can then continue only on the tiles connected to it and not on every other tile and for the life of me i can’t seem to figure out how to do it :ne:
the for loop is as follows
for (var colum = 0; colum < field_h; colum++)
{
for (var row = 0; row < field_w; row++)
{
box = new box_mc();
box.gotoAndStop(1);
box.y = box.width * row;
box.x = box.height * colum;
box.rownumber = row;
box.columnumber = colum;
box.buttonMode = true;
box.addEventListener(MouseEvent.MOUSE_OVER, clickedBox);
container.addChild(box);
}
}
and here is the clickedBox function
{
e.currentTarget.gotoAndStop(2);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_OVER, clickedBox);
e.currentTarget.buttonMode = false;
trace("row:"+e.currentTarget.rownumber +" colum:"+ e.currentTarget.columnumber);
}
i think i should be able to do it using arrays but i can’t seem to understand how after the tiles are placed and the array updated accordingly to update the tiles with the new array value (enter frame event ? )
Thx to all in advance and a virtual beer to everyone :beer2: