Figure 15-2
Part II: Server Side, JavaScript, and Flash: Oh My!
444
The files that compose the project are organized as described in Figure 15 - 3 .
The Flash movie is created starting from a GameClient instance. It is built on Flash version 8 but can
be easily adapted to Flash 9 if needed. One purpose of this class is to visualize the current status of the
game grid and to show to the user the messages transmitted by the server. All the text messages have
been encapsulated in this class. Having the text messages all in the same place is a good practice,
particularly useful when the developer is requested to produce a localized version of the game. The
other purpose of the class is to communicate the user choices to the server. This is done using an
AsyncProxy based on the IPlayerServer interface. Instead of using directly the PlayerServer to
create a proxy, an interface has been extracted with just the methods that can be invoked by the Flash
movie interface. The PlayerServer method _turn that can be executed only on request of some
methods on the server side is protected by a direct interaction with the client using the underscore ( _ )
prefix registered using the setPrivatePrefix() method.
Pages:
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831