To create the packaged MXP file, we need to first create the MXI (Macromedia Extension Information) file. The MXI file is simply a set of XML-based instructions that tells the Extension Manager where to install the packaged files. It also provides vital information about the extension to the Extension Manager, including its name, version number, type, and other stuff we'll get to in a moment.
For more information on the Macromedia Extension Information (MXI) file format, download the PDF at http://www.macromedia.com/go/em_file_format/.
To create the MXI file:
Open a text editor. I prefer to use Dreamweaver MX 2004 for creating MXI files, but you can use Notepad, BBEdit, or any number of others.
Add the following XML to a new file and save it as Percentage Loader.mxi to your desktop. It assigns the extension a name, version number, and type:
Next, add author information. I created this particular component, but you can use your own name if you like. (I'm feeling generous today. Just don't go submitting this thing to the Flash Exchange without giving me credit.)
Now we need to describe which Macromedia product this extension will extend:
Next, we'll add a description of the extension, so users know who's responsible for this little contraption.
Finally, we'll describe which files need to be packaged, and where to put each file in the Flash installation directory. In this case, we have only one file to install, and it needs to install into the Components folder to be accessible via the Components panel:
<macromedia-extension name="Percentage Loader" version="1.0" type="Flash Component (SWC)">
<author name="Robert Hoekman, Jr" />
<products> <product name="Flash" version="7" primary="true" /> </products>
<description> <![CDATA[ Percentage loader for Flash Player 7. ]]> </description>
Then we need to describe to the user how he can access the extension when using Flash:
<ui-access> <![CDATA[ This component can be accessed from the Components panel. ]]> </ui-access>
<files> <file name="Percentage Loader.swc" destination="$flash\Components\10 Minutes with Flash" /> </files> </macromedia-extension>
When you're done, your file should match Figure 2.
Figure 2 The completed MXI file.
And there you have it. That's all the XML you need to know to package a component. Let's finish up. By the way, the 10 Minutes with Flash directory doesn't exist in your Flash installation directory, but it will be created by installing this component, which you'll see in a minute. It's usually a good idea to install custom components into a custom directory. Without specifying a custom directory, Flash automatically creates a Standard Components directory, and your component installs there.