Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe Flash

  • Print
  • + Share This
From the author of

See It In Action

To finish up for today, do this:

  1. Launch Dreamweaver or another HTML editor of your choice, and save it as LocalConnText.htm.

  2. Embed sender.swf into the html page, insert a line break, and then embed receiver.swf. Both of these files should be on your desktop.

  3. Save your work.

  4. Open LocalConnTest.htm in a web browser, enter some text into the text field in sender.swf, and click the Send button.

If you don't have an HTML editor that can easily generate the code with which to embed the two SWF files, copy and paste the following code into a text editor and save the file as LocalConnTest.htm to your desktop:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=",0,29,0" width="300" height="60">
 <param name="movie" value="sender.swf">
 <param name="quality" value="high">
 <embed src="sender.swf" quality="high" pluginspage="" type="application/x-shockwave-flash" width="300" height="60"></embed>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=",0,29,0" width="300" height="50">
 <param name="movie" value="receiver.swf">
 <param name="quality" value="high">
 <embed src="receiver.swf" quality="high" pluginspage="" type="application/x-shockwave-flash" width="300" height="50"></embed>

And there you have it! With the click of a button, your text is sent from one SWF to another and displayed, as shown in Figure 3.

Figure 3Figure 3 SWF-to-SWF communication is fun!

This example is rather simple, but there are countless possibilities for this technique. As mentioned in the beginning of this article, bandwidth usage can (and should) be minimized by creating only one connection to the server. LocalConnection objects can then handle all the communication between SWF files, transferring data from place to place at the browser level.

Until next time, happy Flashing!

  • + Share This
  • 🔖 Save To Your Account