Removing spheres

What happens when gameStatus is removing? Here it is another case to add to our big switch statement in onEnterFrm function:

case "removing" :
for (i=0; i<chainArray.length; i++) {
with (balance) {
if (getChildByName(chainArray[i]).alpha<0) {
var parts:Array=chainArray[i].split("_");

The meaning of this code should be quite clear: the for loop scans for all elements in chainArray array, which are the names of the spheres to remove.

Every child of balance DisplayObject with the name corresponding to each element in chainArray array will have its alpha property decreased by 0.2, ...

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.