Adjusting floating spheres

Floating spheres must be treated like falling spheres. We have to make them fall and check if they form a chain. Let's see the last case to add to the switch statement in onEnterFrm function:

case "adjusting" :
var adjusted:Boolean=false;
for (i=1; i<6; i++) {
for (j=0; j<8; j++) {
if (gameArray[i][j]!=0&&gameArray[i-1][j]==0) {
adjusted=true;
with (balance) {
getChildByName(i+"_"+j).y+=12.5;
if((getChildByName(i+"_"+j).y-25)%50==0){
getChildByName(i+"_"+j).name=(i-1)+"_"+j;
gameArray[i-1][j]=gameArray[i][j];
gameArray[i][j]=0;
}
}
}
}
}
if (! adjusted) {
gameStatus="checking";
}
break;

First, I need a Boolean variable called adjusted to tell the script if all spheres have been adjusted. It starts with false because ...

Get Flash Game Development by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.