The Flash Catalyst project library is a storage area for the reusable content that you add to a Flash Catalyst project. This content includes the bitmap images and other media (video, sound, Adobe Flash movies, and more) that you import. You can import assets individually, as a group, or as a library package. The library also stores the components that you create—things like navigation buttons, scrolling panels, and lists of data.
In this lesson, you’ll learn how to do the following:
• Identify project assets in the Library panel
• Preview images, video, and sound
• Rename assets
• Delete assets from the project
• Use and swap assets in the library
• Compress all instances of a bitmap image
• View the source of library files in the Code workspace
• Import and export a library package
This lesson will take about 40 minutes to complete. Copy the Lesson03 folder into the lessons folder that you created on your hard drive for these projects (or create it now), if you haven’t already done so. As you work on this lesson, you won’t be preserving the start files; if you need to restore the start files, copy them from the Adobe Flash Catalyst CS5 Classroom in a Book CD.
The reusable assets that you add to a project are organized into one of four groups in the Library panel.
Images are bitmap (raster) files (PNG, GIF, JPG, JPE, JPEG) and SWF content.
Media refers to video and sound files (FLV/F4V files, mp3).
Components are the building blocks of your project. Examples of components include buttons, scroll bars, sliders, check boxes, panels, and scrolling lists.
Optimized graphics are added to the Library panel when you choose Optimize Vector Graphics in the Heads-Up Display (HUD). This is true when you optimize an image that you’ve imported and when you optimize an object that you’ve drawn using the Flash Catalyst drawing tools.
Assets get into the Library panel in the following ways:
• When you import a design document, the bitmap images in the document are grouped together in a folder within the Images category of the Library panel. If the design document includes Illustrator symbols, the symbols are converted to optimized graphics and stored in the Optimized Graphics category.
• When you import or copy and paste a single bitmap image, SWF file, or video file, the file is added to the artboard and to the Library panel.
• When you import multiple assets at the same time, the assets are added to the Library panel, but not the artboard.
• When you import a sound file, it’s added to the Library panel.
• When you import a Flash Catalyst Library Package (FXPL) that was exported from another project, the entire collection of assets is added to the Library panel.
• When you optimize an image in the artboard, an optimized copy of the image is added to the Library panel.
• If you compress an image in the Library panel or in the artboard, a compressed copy of the image is added to the Library panel.
• When you convert vector drawings into a component, optimized graphic, raster image, or compressed image, an object is added to the Library panel.
• If you add a wireframe component to the artboard and then modify it, the modified component is added to the Library panel.
In this exercise, you will add a few more assets to the Library panel. When you import a single bitmap image, it’s added to the artboard and the Library panel. But when you import a series of bitmaps or media files (sound and video), they’re added directly to the Library panel, but not the artboard.
This is a copy of the file you created in Lesson 2, “Preparing, Importing, and Placing Artwork.” It includes the images you imported from Adobe Illustrator and a single bitmap image you imported separately.
At first, the Library panel only displays categories for the types of assets that exist in the project. For example, if your project has no media, the Media category does not exist. After adding media, such as a video file, the Media category appears. Once added, the category remains in the Library panel, even after deleting all its contents.
Library assets are divided into categories, such as Components, Images, Media, and Optimized Graphics. These categories can be expanded or collapsed by clicking the small triangle to the left of the category name.
The Images category includes bitmap images that were imported to the project. This includes images that were imported individually or as part of a design document (AI, PSD, FXG). This also includes Adobe Flash movies (SWF files), if there are any.
When you import a design document, its images are grouped together in a subfolder. The folder inherits the name of the original design document, which in this case is the Banner_artwork (Adobe Illustrator) document you imported in Lesson 2.
The sound and video files are added to the Media category in the Library panel. This project now includes three types of assets: Images, Media, and Optimized graphics.
The images are added to the Library panel, but not the artboard.
This was the single bitmap image that you imported in Lesson 2. In the Common category of the Properties panel, notice that the source of this image is man.jpg. There is a direct link between instances in the artboard and the source assets in the library.
The source in the Properties panel (below) changes to Graphic2.
Vector shapes that you draw in Flash Catalyst or import from Adobe Illustrator are not added to the Library panel until you convert this artwork to an optimized graphic, raster image, compressed file, or component.
In the Library panel (shown at right), the new optimized version of this image appears in the Optimized Graphics category.
As your project grows, it can be hard to identify assets by name alone. You’ll want to preview files before adding them to your application. An easy way to do this is to view the file in the preview area at the top of the Library panel.
A preview of the image appears at the top of the Library panel.
You cannot preview SWF files in the Library panel. To view a SWF animation, you must add it to the application and run the project in a browser or publish the application.
As the audio file plays, the Play button changes to the Rewind and Pause buttons.
As the video plays, the Play button changes to the Rewind and Pause buttons.
These folders store the files represented in the Library panel. For each optimized graphic, all MXML information (vector, stroke, path, fill, and so on) is kept separately in an FXG file. Project components, if there are any, are stored in an src/components directory.
Every project entails a little trial and error. As your project evolves, you’ll end up with assets in the library that you no longer need in the finished application.
Eliminating outdated or unused assets from the library reduces the size of the project file, and makes the entire project more manageable. Removing unwanted assets is easy. Just delete them in the Library panel.
A message informs you that you can’t delete the image because it’s being used by the optimized graphic called Graphic2. You cannot delete an optimized graphic’s source file. However, you can delete the optimized graphic or compressed copy of the image.
A message informs you that removing this asset will remove the asset and all references to it. Deleting an object in the Library panel is a fast way to remove every instance of an object from the application.
The image vanishes from the Library panel, and from the artboard. Deleting the image left a hole in the artboard, but you’ll fix that in a minute.
You cannot delete library assets by pressing the Delete key. However, pressing Delete removes objects that are selected in the artboard. If you have an object selected and you accidentally press the Delete key, you will remove the selected object from the current state only.
One of the advantages of a project library is that you can use the same assets throughout your application, and then make global changes to the project by modifying the source file in the library.
For example, you can quickly compress all instances of a bitmap (raster) image to reduce the overall file size of your application.
The Compress Image dialog box appears.
A compressed copy of the image named man1.jpg is added to the Images category. You can tell by the reduced file size that the image is compressed.
Just imagine if everyone you worked with were named Bob. Things could get a little confusing around the office. I suppose you could start calling people Bob1, Bob2, and so on. But that’s not much better. If you’re not careful, your Flash Catalyst project can end up looking like a room full of Bobs. In the world of Flash Catalyst, it’s Graphic1, Graphic2, Graphic3, and so on. An easy way to avoid this is to assign descriptive names to project assets in the Library panel.
The image name is highlighted.
The file is renamed in the Library panel. When you rename a file, any links to the file are updated automatically.
After adding assets to the project library, you can use them over and over in different parts of your application. You simply drag the item from the Library panel and position it in the artboard.
After placing an item in the artboard, the Properties panel shows a link to the source file in the project library. You can quickly swap an object in your application with a different asset through the source link in the Properties panel.
When you drag a library item to the artboard, a new layer is created (in the target layer folder). Best practice is to give a descriptive name to each object in the Layers panel. Renaming an instance of an item in the Layers panel does not affect the original item definition name in the Library panel.
Let’s give it a try by placing the original man.jpg file in the artboard, and then swapping it for the compressed version of the same image.
The source of this image is the man.jpg file in the Library panel. The image in the artboard is an instance of this asset and is linked to the source file in the Library panel.
The Select Asset dialog box opens with a list of assets in the Library panel. You can replace this image with another image in the library. You can also use the Import button to replace the object with a new image that you import now.
If you copy and paste a bitmap, the image is added in the Layers panel and a new asset is placed in the project library. If you copy and paste a vector graphic into the artboard, a new object is added to the Layers panel but not the Library panel. That’s because vector drawings are not stored in the library until you optimize them or convert them to a component.
In the Images category of the Select Asset dialog box, select man_compressed.jpg and click OK.
You have just replaced the image with the smaller, compressed copy of the same picture, as indicated in the Properties panel.
If you create multiple projects that leverage the same assets, or you collaborate with other designers and developers, you’ll be happy to know that you can quickly share the entire contents of a Flash Catalyst project library.
Exporting a library package creates a single file containing every library item in the project. The package is saved as a Flash Catalyst Library Package (FXPL) file.
This opens a copy of the completed Banner project.
The project includes over 90 assets. To recreate these in another project would be a huge task. But exporting the entire library is easy.
The Export Library Package dialog box appears. Flash Catalyst Library Package files use the .fxpl filename extension. By default, the library package uses the same name as the project from which it’s exported.
The entire project library is exported and stored in a file named Banner_completed.fxpl.
The New Project dialog box appears. Normally you would match the project dimensions to the artwork, but for now just accept the default project settings.
A new project opens. Notice the Library panel is empty.
When you add a library package to a project with existing library assets, the new assets are added to the existing library. No files are deleted.
The entire library package is added to the project. The assets appear in the Library panel.
A Flash Catalyst Library Package (FXPL) can be imported by a developer into Adobe Flash Builder as a Flex library project. These objects will maintain any behaviors, transitions, and so on, that you’ve added to them in Flash Catalyst.
1 What types of assets appear in the Library panel?
2 How does a vector drawing that you create in Flash Catalyst end up in the Library panel as a reusable asset?
3 What are some different ways that you can add files to the Library panel?
4 When you select an image in the artboard, how can you tell which asset the image refers to in the Library panel?
5 What types of assets can you preview in the Library panel (list at least three)?
6 What happens to images in the application if you delete an image in the Library panel?
7 Why would you choose to include a linked image in your project?
1 Assets in the Library panel include bitmap (raster) images, optimized graphics, components that you create from artwork, wireframe components that have been modified, SWF files, and media (video and sound).
2 You must convert a vector drawing into a component or optimized graphic before it becomes a reusable asset in the Library panel. To optimize the drawing, select it in the artboard. Then, in the HUD, open the Optimize Artwork menu and choose Optimize Vector Graphics, Rasterize, or Compress.
3 To add files to the Library panel, you can import bitmaps, SWF files, video, and sound. You can also create components and optimize artwork. Wireframe components must be modified before they appear in the Library panel.
4 The Common category in the Properties panel shows the source asset for the selected image. You can use this link to swap the image for another image.
5 You can preview images, video, sound, and components in the Library panel. However, to see the behavior of a component or SWF file, you must run the application in a browser.
6 When you delete an image from the Library panel, all instances of the image, along with any references to the image, are removed from the application.
7 Linked images are stored outside the published SWF file. Linking to large image files can reduce the published file size of the application. Linking to images allows you to update the images later without republishing the application.