• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Managing Outside Communication > Communicating Between Two Movies

Communicating Between Two Movies

So far, you’ve learned how a single Flash movie can communicate outside itself—to retrieve a link on the Web, to incorporate another SWF, or to load an image or video. But can one Flash movie communicate with another entirely independent Flash movie? The answer is yes, with the help of a LocalConnection object. A LocalConnection object enables communication between two separate Flash movies as long as they are running from the same machine (server). Instructions from one movie can control the appearance, behavior, or interactivity of another. Imagine, for example, creating a frameset that contains a Flash movie in a top frame and a Flash movie in a bottom frame. The movie in the top frame could have buttons or pull-down menus that control the movie in the bottom frame. You could also build a Flash-based laboratory simulation in one browser window and keep a Flash lab notebook in another. Information from the simulation could be sent to the notebook and recorded automatically as the experiment progresses.

Using LocalConnection requires that you create a LocalConnection object in the sender movie as well as the receiver movie. Create the new object in both movies with the new constructor function, as follows:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint