Waiting for the disc to be added to stage

We said the player drops the disc with a mouse click. Unfortunately, we cannot place a mouse click listener to the disc itself as it would trigger only if the player clicks on the disc. It's not that intuitive, as the player expects to place the disc with the mouse and release it by clicking anywhere.

We can solve this issue by adding a mouse click listener on the stage, and once triggered, check if it's a possible move and eventually place the disc in its place and pass the turn to the other player.

Unfortunately, a programmer's life is never easy, and it's not possible for DisplayObjects access the stage if they aren't on the Display List yet.

AS3 comes to our help with Event.ADDED_TO_STAGE that triggers ...

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.