Adjusting bubble position and reloading
The final step of firing a bubble is adjusting its final position so that it perfectly fits inside a cell. Only at this time we can load another bubble into the cannon.
The idea: Once the bubble reached the top of the game field, we have to place it in the closest cell available. Then, we'll place a new randomly colored bubble into the cannon, allowing the player to shoot again and starting the game loop again.
The development: When the bubble reaches the top of the game area, we'll call a new function to delegate the parking process of the bubble.
onEFrame function to execute only a function called
parkBubble, when the bubble is about to leave the game field to the top.
private function onEFrame(e:Event):void ...