- Designing Your Web Site to Be Modular
- Loading Movies or JPGs
- Task: Use Load Movie
- Determining When a Movie Is Fully Loaded and How to Unload It
- Task: Determine Whether a Movie Is Fully Loaded
- Shared Library Items
- Task: Prepare Items to Share at Runtime
- Task: Start Using a Shared Item
- Task: Update Shared Items in a Library
- Task: Share a Font During Runtime
- Linked Scripts
Task: Update Shared Items in a Library
In this task, you'll learn how to update the contents of a Shared Library. Follow these steps:
Open the source of your Shared Library (shared.fla). Take note of what the identifier is for the bitmap (select it and select Linkage ... from the Library's Options menu). Delete this bitmap from the Library and import another bitmap that will serve as a replacement.
Access the newly imported bitmap's Symbol Linkage Properties via Linkage... on the Options menu, set it to Export for runtime sharing, and specify the same identifier as the old bitmap (probably image).
Save the movie and export an .swf (Ctrl+Enter).
Now double-click any user files you've made (user1.swf, for example). They should now reflect the change.
That was almost too easy. You simply created a new Library item in the master Shared Library file (shared.fla), made sure it would export, and gave it an identifier name that matched the old one. Then, as soon as you exported the .swf, it worked. Basically, each user file doesn't care what's inside the master Shared Library; it simply looks for items that match identifier names. For example, if you have a Movie Clip containing English language text and swap it with one containing Spanish, as long as the identifier is the same, it will work fine (it would just appear in a different language).
Although you can probably start to see how Shared Library items can enhance productivity, remember that their other benefit is file size savings. The shared.swf file only downloads once. This might make you want to include larger items (like sounds and raster graphics). But you should know that when sharing items the source (Shared Library) must download entirely before the user files begin to play. For this reason you really should use loadMovie for larger elements so that you can control and monitor their downloading (like you did in an earlier task). The most appropriate time to use runtime sharing is when you have lots of small items that you expect might need to change periodicallyfor example, a seasonal icon used in several different pages of your Web site. The icon (saved as Export for runtime sharing) could change from themes for Halloween to Thanksgiving to New Year's.
Fonts are another Library type that can be shared. If you use the same font throughout several movies, sharing that font during runtime makes sense. You'll do just that in the next task.