Runtime Sharing: The Really Cool Part
So now that you've got a handle on authortime sharing, it's time to do something a little more stylish: runtime sharing. This technique will help you cut down on file size by importing assets from a shared library into other movies while they are running. Again, it's very simple to do.
Open up the copy of Shapes.fla you still have on your Desktop and open the Library for that file.
Right-click (Ctrl_click for Mac) on the Box symbol in the Library and choose Linkage.
Checkmark the option called Export for runtime sharing. This will give the ability to give the Box symbol and identifier and specify from where the symbol will be exported.
The name Box should appear automatically in the Identifier field. If it doesn't, enter it. Leave the checkmark for Export in first frame alone.
In the URL field, type Shapes.swf. This is the name of the file that will contain the Box symbol. See Figure 7 to make sure everything matches. Then Click OK.
Repeat these steps for the other two symbols, giving them identifiers of Circle and Triangle. You'll notice that as soon as you click the Export for runtime sharing option in the Linkage dialog box for these symbols, the Identifier and URL files are filled in automatically. Flash figures that because you're exporting one asset from Shapes.swf, you'll want the others to use the same filename.
Save your work and publish the movie by choosing File > Publish. Then close Shapes.fla.
Open up yet another blank document and open the Library for the new. FLA. This time, save the file as receiver.fla to your Desktop.
Choose File > Import > Open External Library again and choose Shapes.fla from your Desktop.
Drag an instance of the Box symbol onto the Stage. Notice that it once again adds a copy of the symbol into the Library for receiever.fla.
Right-click on the Box symbol in the Library for the receiver.fla and choose Linkage. This time, you'll see that the Linkage Properties dialog box has Import for runtime sharing already checked, and the URL field says Shapes.swf (see Figure 8). This means that receiver.fla will grab the asset from Shapes.swf instead of making a full copy of the symbol into its own Library. Click OK to close the Linkage dialog box.
Choose Control > Test Movie to generate a .SWF. In the Preview window, choose View > Bandwidth Profiler. Notice that for Size, the Bandwidth Profiler says 0. Because the Box symbol is not stored in the Library for this movie (it is pulled from Shapes.swf), the asset does not add any file size to this file.
Close the Preview window, save your work, and quit Flash.
Figure 7 Linkage Properties. Even more fun.
Figure 8 Shared assets...served up hot and fresh.
If you had 10 assets in a shared library, and used them all in 15 different movies on a Web site, the assets in the shared library would have to load only once to the user's computer. And none of those assets would add any file weight at all to the movies using them. This is the magic of shared libraries.