10.9 Creating a Flash MX Web Service Extension

Flash MX and the other MX programs allow you to install Flash panels that become part of the authoring environment. The Community MX and Amazon.com examples from this chapter can be placed in the WindowSWF folder in the multiuser Configuration folder of Flash MX, located in the following location in a typical Windows 2000 installation:

C:\Documents and Settings\username\Application Data\Macromedia\Flash MX\Configuration\WindowSWF

Note that the folder is a hidden folder by default in Windows. Hidden folders can be shown with Tools Folder Options View Hidden files and folders Show Hidden files and folders. For Macintosh OS X, the folder is located at:

Hard Drive/Users/Library/Application Support/Macromedia/FlashMX/Configuration/WindowSWF

If you have a single-user operating system, such as Windows 98 or Macintosh OS 9, the folder can be found in your main Flash MX installation folder.

Simply dropping a .swf file in this folder allows you to use the Flash interface as a dockable panel in Flash MX. You can easily add other types of panels that utilize other public web services or ones of your own design, and even package these as extensions for consumption by other users of Studio MX products. To package a Flash .swf file as an extension, you have to create an extension package. This is done by first creating a special XML file with a .mxi file extension.

More information on the Macromedia Extension Installation file format (MXI) can be found at the Macromedia site at http://download.macromedia.com/pub/exchange/mxi_file_format.pdf.

The .mxi file for the Community MX Content extension might look like this:

   name="Community MX Content"
   type="Flash Panel">

  <author name="Thomas Muck" />

    <product name="Flash" version="6" primary="true" />

  The Community MX Content panel shows the latest content from Community MX  ]]>

  After installing the extension, you can find the Community MX Content panel in
  the Window menu of Flash MX.

    <file source="Community MX.swf" destination="$flash/WindowSWF" />


Using the $flash variable in the .mxi file, you don't have to know the path to Flash on the user's machine; the Extension Manager takes care of the details of installing the panel to the user's Flash\WindowSWF folder.

If you place this .mxi file in the same folder as your .swf file and double-click it, the Macromedia Extension Manager launches in its packaging mode. It prompts you to create a new package and save it on your hard drive. The package is created with an .mxp file extension (the .mxi file is bundled inside). The Flash extension package (the .mxp file) can be installed by anyone with Flash MX or later. The Extension Manager is shown in Figure 10-4.

Figure 10-4. The Macromedia Extension Manager

This technique for packaging extensions can be used with many types of Flash movies, allowing you to create your own interface elements of the Flash MX environment. The NetConnection debugger and the Service Panel are examples of Flash MX extensions built as .swf files in this way. The Community MX panel is shown in Figure 10-5.

Figure 10-5. The Community MX web service example as a Flash panel

MXI creator programs are available to help create MXI files for Macromedia extensions, such as one created by Muzak at http://www.muzakdeezign.com/mxi_creator/about.asp. Flash 2004 and Flash Pro feature a JavaScript extensibility layer, such as that available in Dreamweaver MX, so expect to see more Flash extensions in the future. Consult the resources cited in Appendix A.

    Part III: Advanced Flash Remoting