Working with MXP Files

Up to this point in the book, you have worked mostly with components that were already set on the stage. However, typically you'll want to create an instance of a component by dragging the component either from the library or from the Components panel.

Whenever you have components on the stage, Flash will automatically place them in the library just like any other symbol (such as movie clips, buttons, and the like). One obvious way to create a new instance of a component is to drag it from the library onto the stage.

To try this: select all of the instances of the PixelButton component and delete them. Now open the library and notice that the PixelButton component has a custom icon.

Click the PixelButton component in the library and look carefully at the preview window. Notice that nothing but a thin, rectangle outline appears in the preview window (see Figure 4.18). This is because the PixelButton component utilizes Flash MX's new ability to draw shapes programmatically. Drag an instance of the component onto the stage and notice that a button is immediately drawn on the stage.


Figure 4.18: Flash MX can draw shapes programmatically.

Dragging a component from the library to the stage is obviously a very easy way of creating an instance of a component. However, if you are working on a project with a lot of resources in your library, it might be a little difficult to hunt down the component in the library. Also, you may not even have the component in your library to begin with. If you use a component frequently, you might want a more central location for your components.

start sidebar

You wouldn't be able to see this button on the stage without Live Preview. Typically, you would have to publish a movie to view the results of code used to draw shapes. However, Live Preview lets you see the button without publishing the movie.

end sidebar

For example, you may have a component, such as the PixelButton component, that you want to use in a series of projects. In this case, it would be nice to have the component in an easily accessible place rather than copy the component from project file to project file.

The Components panel allows you to essentially install components into Flash so that they are accessible to any Flash file you happen to be working on. While you can manually install components into the Components panel by dragging them into the Flash MX/ FirstRun/Components folder (where you have Flash installed on your local system), this method has an important drawback. Specifically, it is hard to remove components that have been manually installed.

On the CD 

The best way to add and remove components to the Components panel is by using Macromedia Extension Manager (see Figure 4.19). This is a separate utility; it can be easily downloaded from a link on the companion CD.

click to expand
Figure 4.19: Macromedia Extension Manager provides an easy way to install and remove components to and from the Components panel.

start sidebar

The word Extension in Macromedia Extension Manager can be confusing. Macromedia has a little bit of an identity crisis where components are concerned. Although Macromedia has designated these resources as components, Macromedia also refers to them as extensions, and, of course, they were originally called smart clips. The word extension does, however, reflect the fact that Extension Manager can be used to manage extensions for many Macromedia applications, such as Dreamweaver, Director, and even Flash 5.

end sidebar

If you do not have Macromedia Extension Manager installed, take a few moments to install it and open it. Extension Manager will recognize any Macromedia program on your system that supports extensions it can manage. Therefore, the first thing you'll need to do is make sure that Flash MX is selected (see Figure 4.20).

click to expand
Figure 4.20: Select Flash MX from the drop-down list.

Now select Install Extension from the File menu in Macromedia Extension Manager. Notice that the default file type in the Files Of Type field is the Macromedia Extension Packages or .mxp format. MXP files contain one or more components to be installed into Flash. You will learn how to create MXP files in Chapter 11.

On the CD 

Now let's install an MXP file. Go to the Chapter 4 directory on the CD and locate the PixelComponentSet.mxp file (see Figure 4.21). Double-click the file to install it. The first thing you will see is the standard Macromedia Extensions Disclaimer, shown in Figure 4.22, which is basically a means for Macromedia to say, "Install this component at your own risk."


Figure 4.21: Open the Pixel-ComponentSet.mxp file from the Chapter 4 directory.


Figure 4.22: The Macromedia Extensions Disclaimer

Click the Accept button. After you do, Extension Manager displays a dialog box letting you know the components have been installed. Click the OK button.

We will be installing more MXP files in later chapters, and we will take another look at Macromedia Extension Manager once we've installed a few more components. For now, close Extension Manager. If you have Flash MX open, save any files you have open, close Flash, and then reopen Flash to get the changes made by Extension Manager to take effect.

Flash opens with an untitled document, and this will work just fine for our purposes. Open the Components panel either by selecting Components from the Windows menu or by pressing Command/Ctrl+F7.

start sidebar

Notice that the shortcut keys for opening the Components panel and the Component Parameters panel are similar. Command/Ctrl+F7 opens the Components panel, while Option/Alt+F7 opens the Component Parameters panel.

end sidebar

Click the small, black, down-arrow in the top-right area of the Components panel and select PixelComponentSet from the pop-up menu (see Figure 4.23). You should now see three components in the Components panel. The first component is the PixelButton component (which is the same component we looked at earlier).


Figure 4.23: Selecting PixelComponentSet from the pop-up menu

The other two components are called PixelFlatRadioButton and PixelRadioButton. These components are very similar to the PixelButton component. In fact, they were generated from the PixelButton component. After working through the parameters for the PixelButton, the parameters for these components will be very familiar.

The nice thing is that all three of these components are related and can be displayed together in the Components panel. Components in this panel are similar to plug-ins that have been installed in programs such as Adobe Photoshop. The components can be accessed by any file that you open in Flash much like any plug-in installed in Photoshop can be applied to any file you open in Photoshop.

If you have just installed Macromedia Extension Manager, then you probably don't have many components installed in the Components panel. However, as you begin to work more and more with components, you might find the list of components that are installed in the Components panel getting excessively long. In later chapters, we will install more MXP files, and then we will look at how you can manage your components with Extension Manager.

Finally, notice that each of the components in the PixelComponentSet have a unique custom icon. This helps to differentiate them. You will learn how to create custom icons for components in Chapter 11.




The Hidden Power of Flash Components
The Hidden Power of Flash Components
ISBN: 0782142109
EAN: 2147483647
Year: 2002
Pages: 111

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