[ Team LiB ] |
Recipe 17.5 Communicating Between Movies on Different Computers17.5.1 ProblemYou want to create a channel of communication between two or more movies on different computers. 17.5.2 SolutionCreate a remote shared object and connect each of the clients to it. 17.5.3 DiscussionLocalConnection objects can be used to communicate between movies on the same computer but not on different computers. Remote shared objects offer a way to create channels of communication between multiple computers acting as clients of a FlashCom application. Remote shared objects can be either persistent or nonpersistent. In most cases where you simply want to create a channel of communication between FlashCom clients, there is no need to create a persistent shared object (in which the data is stored to disk). On the other hand, if you want to save the data between sessions or restarts of the FlashCom application, you should make the shared object persistent, as discussed in Recipe 16.6. Each client must create a client-side remote shared object using the SharedObject.getRemote( ) method and connect using the connect( ) method: // Create a nonpersistent client-side RSO and connect it to the server. This example // assumes that you have an existing net connection object named myConnection. myClient_r_so = SharedObject.getRemote("clientComRSO", myConnection.uri, false); myClient_r_so.connect(myConnection); 17.5.4 See AlsoSee the Introduction to Chapter 16 as well as Recipe 16.6 for more information regarding remote shared objects and the details of the get( ), getRemote( ), and connect( ) methods. See Recipe 17.6 for further information on using an RSO to communicate between connected FlashCom clients. Also refer to Recipe 14.15 and Recipe 17.1. |
[ Team LiB ] |