I have a loop that finds objects next to a centre object, adds them to an array, and searches for their neighbours until it has found all the objects that neighbour each other. Unfortunately, when I get to the end of the loop,I get an array out of range index, why is the break command not working?
Here are the first 2 lines, how do I break ?
for ( var w2:int=0; w2 < 400; w2 ++) {
centreobject = foundwalls[w2];
--==find objects around centreobject and add them to foundwalls[];==--
//if ( w2 == foundwalls.length-1 ){break; }// <---tried this! still goes out of range!
}