The Macromedia Flash Exchange


The Macromedia Flash Exchange is a clearinghouse for extensions for Flash 5 that have been created either by Macromedia or by members of the Macromedia development community. Most of the extensions are free. The available extensions include Smart Clips, ActionScript files, mini-applications, tutorials, templates, Generator objects and templates, clip art, previous Macromedia Dashboard movies, and more. Before you start any project, visit the Flash Exchange. You don't want to waste your time reinventing the wheel.

Before you can use the extensions at the Flash Exchange, you need to download and install the Macromedia Extension Manager. With the Extension Manager installed, you can install or delete extensions for Flash 5, DreamWeaver 3, or UltraDev 4.

The really cool thing is that you can use the Extension Manager to package your own Smart Clips for inclusion on the Exchange. You can share your knowledge with the world. (See Figure 22.3.)

Figure 22.3. The Macromedia Extension Manager is used to take the pain out of installing extensions for Flash 5, Dreamweaver 4, and UltraDev 4. You also can use the Extension Manager to package your own extensions and submit them to the Flash Exchange.

graphics/22fig03.gif

The Macromedia Extension Manager

The Extension Manager is a free addition to Flash 5 that enables you to add, delete, and package extensions for Flash. To download the Extension Manager, go to http://www.macromedia.com/exchange/flash and find the Macromedia Extension Manager link. To install the Extension Manager, follow the directions on the download page.

After you install the Extension Manager, you can access it by choosing Help > Manage Extension Items from the main menu in Flash 5. Of course, the Extension Manager is no fun if you don't have anything to install, so you need to go back to the Flash Exchange and pick an extension or two to download.

If you want to take a look at a fun Smart Clip, do a search on "Tool Tip" and download Branden Hall's Tool Tip Smart Clip.

Notice the filename of the file you are downloading. It ends in MXP . MXP stands for Macromedia eXtension Package. The MXP file bundles two other files:

  • The file(s) to be installed (FLA, AS, and so on)

  • The Macromedia eXtension Installation (MXI) file used to handle the installation

You'll be learning more about MXI and MXP files later in this chapter. For now, just download an extension to your hard drive.

After you downloaded a file, you need to do the following:

  1. Open the Extension Manager (Help > Manage Exchange Items).

  2. Select File > Install Extension, browse to the MXP file you downloaded, and then click Install.

That's it. You don't even need to restart Flash. After the extension is installed, the name of the extension and its version, type, and author will appear in the upper pane of the Extension Manager.

To see a description of what the extension does and how you use it, just click the extension name to see a description in the lower pane.

To uninstall an extension:

  1. Select the extension.

  2. Choose File > Remove Extension (or click the Trash Can icon).

  3. Click Yes to remove the extension.

If the removal was successful, you'll get a pop-up message that says "The extension has successfully been removed."

Now that you have the Extension Manager installed, why not use it to package the Smart Clip you just created?

Packaging an Extension

Packaging a Smart Clip for inclusion on the Flash Exchange is a six-step process:

  1. Create an awesome Smart Clip.

  2. Make sure you have the latest version of the Macromedia Extension Manager.

  3. Create an installation file.

  4. Package the extension.

  5. Test your packaged extension to make sure you haven't made any bone-headed mistakes.

  6. Submit your file to Macromedia so that they can test to make sure you haven't made any bone-headed mistakes.

After you've completed all these steps, you can sit back and win accolades and admiration from your peers. Or not.

Why not try packaging the Smart Clip you just created? I strongly suggest you skip Step 6 submitting the extension to Macromediaunless you've made some significant performance enhancements to the existing clip.

Packaging Your Smart Clip

You've already knocked off the first requirement. So maybe it's not an awesome Smart Clip, but it's something to work with. Don't complainyou didn't have to think of it yourself.

Checking the Version of Your Extension Manager

The next thing to do is make sure you have the most recent version of the Extension Manager. If you just downloaded and installed the Extension Manager, skip to the next section. As of September 2001, the most recent version of the Extension Manager was Version 1.2. To check your version, do the following:

  1. Visit the Exchange at http://www.macromedia.com/exchange/Flash and click the link to the Macromedia Extension Manager to see what the latest version is.

  2. Open Flash 5.

  3. Select Help > Manage Exchange Items from the main menu.

  4. When the Extension Manager opens, select Help > About Macromedia Extension Manager.

  5. The version number is in the lower-left corner.

If your version matches the one on the Macromedia site, you're good-to-go. If it doesn't, you need to download and install the new Extension Manager.

After you're sure you have the most recent version of the Extension Manager, you're ready for the next step.

Creating an Extension Installation File

The file that you need to create to install your extension is an Extensible Markup Language (XML) file that you save with an MXI file extension. Don't freak out. XML is just a standard format for exchanging information. It structures information in a way that is easily reused in multiple situations and it's not hard to work with at all. You'll be working more extensively with XML in Chapter 23, "Introduction to XML." In this chapter, you'll walk through the basics of creating an installation file for your Smart Clip. The MXI file extension just stands for Macromedia eXtension Installation.

What does the XML in the MXI file look like? It's not terribly complex, as you can see in Listing 22.2. The only things that you actually need to change are bolded.

Listing 22.2 The XML Inside the MXI Installation File Is Really Not Very Complex, and There Are Only a Few Attributes That You Need to Change
 <macromedia-package   name="  name of smart clip  "   version="1.0"   type="Smart Clip">  <author name="  your name  " />  <products>     <product name="Flash" version="5" primary="true" required="true" />  </products>  <description>  <![CDATA[  Describe the smart clip  .  ]]>  </description>  <ui-access>  <![CDATA[  Tell them where to find the smart clip  ]]>  </ui-access>  <files>    <file source="  smart clip file name  " destination="$flash/Libraries" />  </files>  </macromedia-package> 

As you can see from the listing, the code has a very specific structure to it. The most common mistake you'll make when working with XML files is to not close one of the tags. Most of the tags come in pairs, such as the following:

 <products></products> 

The tags that don't come in pairs don't contain any additional content and must end with />, as in the following:

 <author name="your name" /> 

For more detailed information on creating installation files for extensions other than Smart Clips, download a copy of the MXI file format PDF from Macromedia's Web site. You also can download the MXI sample files by Matt Wobensmith on the Flash Exchange.

These are MXI files that you can adapt for your own use. The MXI samples are available as an extension from the Flash Exchange. With these files as a template, you can quickly set up installation files for any kind of Exchange item. After you walk through the process for setting up one MXI file, the rest are easy. At the end of this chapter, you'll find some guidelines for setting up installation files for other types of extensions.

Now it's time for you to create an installation file for your Smart Clip.

Exercise 22.5 Creating an Installation File (MXI)

You'll start by modifying an existing template MXI file.

  1. Open sample.mxi in a text editor, such as NotePad or SimpleText. You can find the file in the Chapter 22/Assets folder.

  2. The first thing you need to do is give the Smart Clip a title. The title is how it will be listed on both the Flash Exchange and in the Extension Manager. In the very first tag in the file, change this:

     name="name of Smart Clip" 

    To the following:

     name="Smart Bullet Points" 
  3. Next you need to tell the world who you are. In the second tag, replace the text your name with your real name. Make sure your name is enclosed in quotes.

  4. Now you need to scroll down to the <description> tag. You need to describe what your Smart Clip does. This description will appear on the Flash Exchange and in the Extension Manager. This section of the file currently looks like this:

     <description>  <![CDATA[ Describe the Smart Clip.  ]]>  </description> 

    You want to change the third line to this:

     <description>      <![CDATA[     This Smart Clip allows you to mimic a PowerPoint presentation.      Every time you press a key on the keyboard, another line of      your presentation will appear.<br><br>  To use this Smart Clip place an instance of it on the stage, set its  options via the Clip Parameters panel.  <br><br>  Configurable options include:  Bullet Type  Bullet Text  Bullet Spacing      ]]>      </description> 

    Notice that you use the standard HTML <br> tag to force line breaks.

  5. You also need to let people know where in the Flash user interface (UI) they'll be able to find your Smart Clip after it is installed by the Extension Manager. Smart Clips show up in the Common Library menu after they've been installed. Change the <ui-access> tag to the following:

     <ui-access>  <![CDATA[ This item is accessed by choosing Window > Common Libraries >  SmartBullets.  ]]>  </ui-access> 
  6. All that's left to do in the MXI file is to tell the Extension Manager what file you'll be packaging. Change the <files> tag to the following:

     <files>      <file source="SmartBullet.fla" destination="$flash/      Libraries"/>  </files> 
  7. Save your file as SmartBullet.mxi.

In the next section, you'll take your Flash file and your MXI file and use the Extension Manager to package them into a format that the Extension Manager can use.

Using the Extension Manager to Package Your File

After you have the file you want to package as an extension and the MXI file created, you can use the Extension Manager to bundle them into an MXP file.

As a general practice, it's a good idea to put the files you are packaging into one folder, just to make sure you have everything together and organized. That way, you don't have to include any path information in your MXI file.

When you're ready, all you have to do is the following:

  1. Launch the Extension Manager (Help > Manage Exchange Items).

  2. From inside the Extension Manager, choose File > Package Extension.

  3. In the Select Extension to Package dialog box, you browse to the MXI file you created (your extension installation file), and then click OK.

  4. Next you choose a location for your new MXP and give it a name.

  5. Use the Extension Manager to install your new extension.

It's a fairly painless process. Just don't put any spaces in your extension filename and keep the length of the filename to 31 characters or fewer to keep it Macintosh-happy.

You know what to do. Now it's time to do it. In the next exercise, you'll package your extension.

Exercise 22.6 Packaging Your Extension

You'll start by doing a little housekeeping.

  1. Create a new folder on your hard drive called SmartBullet. Copy the smartBullet.mxi file you just created and the final version of SmartBullet.fla into the new folder. If you were working with the numbered files, rename your finished file SmartBullet.fla.

  2. From inside of Flash 5, launch the Extension Manager (Help > Manage Exchange Items).

  3. Choose File > Package Extension to launch the Select the Extension to Package dialog box.

  4. Browse to the SmartBullet folder on your hard drive, select the SmartBullet.mxi file, and then click OK. (See Figure 22.4.)

    Figure 22.4. In the Select Extension to Package dialog box, you browse to the MXI file you created and then click OK.

    graphics/22fig04.gif

  5. When the Save Extension Package As dialog box comes up, save your MXP as SmartBullet.mxp in the SmartBullet folder.

  6. If all went well, you'll get a pop-up message that says "The extension package has been successfully created." Click OK.

That wasn't so bad, was it? But you're not done yet. Before you can send your new extension off to the Flash Exchange, you need to try installing it on your own machine. You also need to test it.

Installing and Testing a New Extension

The first thing you need to do is use the Extension Manager to install your new extension in Flash 5. After that, you need to try the extension out to make sure that it works.

The installation process is easy:

  1. Launch the Extension Manager in Flash.

  2. Choose File > Manage Exchange Items.

  3. Choose File > Install Extension.

  4. Browse to the MXP file you just created.

  5. Accept the licensing agreement. You should get a pop-up message that says the following: "The 'Smart Bullet Points' extension has successfully been installed."

  6. Close the Extension Manager.

With that done, you can test your new extension:

  1. Create a new Flash file. You don't have to restart Flash; your menu is automatically updated.

  2. Choose Windows > Common Libraries > SmartBullet to open your Smart Clip as a Library.

  3. Drag a copy of the SmartBullets Smart Clip onto the Stage.

  4. Open the Clip Parameters panel (Window > Panels > Clip Parameters).

  5. Make some changes to the values and test your new movie.

You aren't limited just to creating and packaging Smart Clips. You can do the same for several types of extensions.

Installing Other Extensions

The basic process for packaging extensions is pretty much the same for any extension you choose to package. The one item that will be slightly different for each extension type is the <file></file> attribute in the MXI file. There are eight types of extensions you can create. The extensions, general guidelines, and changes to the MXI files are described in the following sections.

ActionScripts

Comment your code! I know hard- core programmers hate to comment code, but tough. Do it anyway. How are other people supposed to understand your brilliant code if you don't tell them what it does?

Please use meaningful variable and function names . Remember that other people are going to be looking at your code. Having incomprehensibly named functions and variables is like having a drawer full of dirty socks. It's badon so many levels.

The changes you need to make to the files attribute in the MXI file are as follows :

 <files>      <file name=  "yourFile.as"  destination=  "$flash/ActionScript"  />  </files> 

Next you'll take a look at the Generator object.

Generator Object Extension

Building Generator objects is beyond the scope of this book. For information on guidelines to follow, you can read the "Extending Generator" documentation.

Notice that the Generator object requires three separate files: a definition file, a class file, and a Java file. Also note that the different elements of the Generator object install in different directories for Windows and Macintosh.

The changes you need to make to the files attribute in the MXI file are as follows:

 <files>      <file name="  yourFile.def"  destination="  $flash/generator/template"  "  platform="win"  />      <file name="  yourFile.class"  destination="  $generator/classes"   platform="win"  />      <file name="  yourFile.java"  destination="  $generator/extras/  "  YourFolder" platform="win"  />      <file name="  yourFile.def"  destination="  $flash/generator/template"   platform="mac"  />      <file name="  yourFile.class"  destination="  $flash/generator/classes"   platform="mac"  />      <file name="  yourFile.java"  destination="  $flash/generator/extras/   YourFolder" platform="mac"  />  </files> 

You already know how to create custom keyboard shortcut sets in Flash. Did you know that you can package those as extensions as well?

Keyboard Shortcuts

You can create custom keyboard shortcut sets and package them as an extension. Create the shortcut sets in Flash and copy the WFX and MFX files in the Keyboard Shortcuts file to a new folder and then package them.

The changes you need to make to the files attribute in the MXI file are as follows:

 <files>      <file name=  "yourFile.wfx"  destination=  "$flash/Keyboard Shortcuts"   platform="win"  />      <file name=  "yourFile.mfx"  destination=  "$flash/Keyboard Shortcuts"   platform="mac"  />  </files> 

You've probably created custom Libraries for use inside Flash.You can package those as well.

Libraries

Any Library files you create should be well organized and use folders. Make sure your Library elements have meaningful and appropriate names.

The changes you need to make to the files attribute in the MXI file are as follows:

 <files>      <file name=  "yourFile.fla"  destination=  "$flash/Libraries"  />  </files> 

The different Publishing Templates for Flash 5 are found on the HTML tab of the Publish Settings dialog box.

Publishing Templates

You also can package custom templates for publishing Flash files.

The changes you need to make to the files attribute in the MXI file are as follows:

 <files>      <file name=  "yourFile.html"  destination=  "$flash/HTML"  />  </files> 

You might find that for some of your extensions, you need to create a sample file to help people understand what to do.

Sample Files

You might decide to create sample files for an extension you are packaging. If you have a single sample file, you can upload it to the Samples folder. Otherwise, you should have the installation file create a new folder for your files.

The changes you need to make to the files attribute in the MXI file are as follows. For the single sample, use this:

 <files>      <file name=  "yourFile.fla"  destination=  "$flash/Samples"  />  </files> 

For multiple samples, use the following:

 <files>      <file name=  "yourFirstSample.fla"  destination=  "$flash/   YourSampleFolder"  />      <file name=  "yourSecondSample.fla"  destination=  "$flash/   YourSampleFolder"  />      <file name=  "yourThirdSample.fla"  destination=  "$flash/   YourSampleFolder"  />  </files> 

You've already taken a close look at how you package a Smart Clip.

Smart Clips

Make sure you put all the assets for your Smart Clip in a single asset folder. If you've created a custom user interface for the Parameters panel, you also need to include the user interface FLA and SWF files. Otherwise, you can omit those two lines.

The changes you need to make to the files attribute in the MXI file are as follows:

 <files>      <file name=  "yourFile.fla"  destination=  "$flash/Libraries"  />      <file name=  "yourUI.fla"  destination=  "$flash/Libraries/Smart Clip   UI"  />      <file name=  "yourUI.swf"  destination=  "$flash/Libraries/Smart Clip   UI"  />  </files> 

Finally, you also can submit projector files as extensions.

Utility Files

If you decide to submit a Flash projector as a utility, you have to package the original FLA in the MXP so that it can be evaluated by Macromedia.

The changes you need to make to the files attribute in the MXI file are as follows:

 <files>      <file name=  "yourFile.fla"  destination=  "$flash/YourFolder"  />      <file name=  "yourFile.fla"  destination=  "$flash/YourFolder"  />  </files> 

The MXI file you create might contain more than one type of extension. For example, if you wanted to package a Smart Clip and several samples of how to use the Smart Clip, the files attribute in the MXI file would look like this:

 <files>      <!Smart Clip Files ->      <file name= "yourFile.fla" destination= "$flash/Libraries" />      <file name= "yourUI.fla" destination= "$flash/Libraries/Smart Clip      UI" />      <file name= "yourUI.swf" destination= "$flash/Libraries/Smart Clip      UI" />      <!"Sample Files ->      <file name="yourFirstSample.fla" destination="$flash/      YourSampleFolder" />      <file name="yourSecondSample.fla" destination="$flash/      YourSampleFolder" />      <file name= "yourThirdSample.fla" destination="$flash/      YourSampleFolder" />  </files> 

That sums up most of what you need to know about packaging extensions for distribution. If you really want to get into the nitty-gritty details, download the MXI File Format PDF on Macromedia's Web site.



Inside Flash
Inside Flash MX (2nd Edition) (Inside (New Riders))
ISBN: 0735712549
EAN: 2147483647
Year: 2005
Pages: 257
Authors: Jody Keating

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net