Shared Libraries: Defense, Tips & Tricks

…ok, I lied. I just gotta post.

Great post on Flashcoders today defending shared libraries and offering some great tips.

<a href=”http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:79294″>http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:79294</a>

We’ve been using them daily for a little over 2 years. Very handy–a necessity in our case. Of course, there are a few issues you have to contend with (surprise). IMHO, the bandwidth savings are well worth dealing with the issues, but (as with many other things), I’d like to see Macromedia spend the time to get it right/more robust/less bugs. (Isn’t it about time for MX2/Flash 7?)

Anyway, if you’re willing to deal with a little hassle, you’ll get good payoffs. And I don’t think they’re nearly as bad or troublesome as some have claimed.

-If any of your linkage is messed up, any shared items in the client movie may fail to display on the first frame that you place them.

-Shared embedded fonts can’t display inline bold/italics (since they’re actually separate fonts), although there is a nifty hack around this (place an empty dynamic textfield on the stage of the shared library that embeds all outlines, uses the shared font (shared fonts appear in the font list with an asterisk after the Export ID you assigned to it), and has the desired bold/italics btns pressed.

-You absolutely must be using a robust preloader or you’ll be in for loading trouble hell. I can’t recommend any, as I rolled a custom one a long time ago. Bokel (I think) has one that just went to 1.0 that looks pretty good, though.

-We’ve had to place one shared symbol on the stage in the first frame of every client movie, or we’ve run into difficulties getting things to display (even though they’re static instances placed on the stage).

-Shared library naming: It seems like this was confusing at first. As our shared library develops, the FLAs are named shared_xx.fla. The latest version is *always* published to shared.swf. And the latest shared_xx.fla is *always* copied to shared.fla. Now the name isn’t important, but the consistency of keeping an up-to-date shared.fla and shared.swf around is because:

-When you’re ready to setup a client movie (importing shared symbols to start working with them), you’ll import them from your shared.fla. You do this making sure your shared.fla is closed, then use “Open as Library”. Then you can simply drag the desired symbols over into your client movie’s library. If done correctly, all your linkage will be setup for you and you won’t have to touch anything(!) And as you can imagine, going through and fixing the linkage for a bunch of symbols (4-500 here) is no picnic. But be forewarned, Flash is touchy about importing symbols like this. I’ve had it crash/GPF when trying to one to a few hundred at a time. It seems like doing a folder at a time, anyway.

Have fun.

Jacob Hanson

2 Replies to “Shared Libraries: Defense, Tips & Tricks”

  1. I know this post was a very long time ago but I need to find out if this works in Flash 8 as I cannot get it to work. You said ‘Shared embedded fonts can’t display inline bold/italics […], although there is a nifty hack around this […]’

    Does this still work in 8 or is there a better way. You are the number one result when searching on the topic of inline style changes with shared fonts.

    Thanks.

  2. We’re using Flash 8 FlashType fonts are a very large site right now using SharedLibraries NOT on _level0 and it works fine. I don’t remember trying to get them bold or italic, though. Regardless, one font is bold, and requires the bold button to be pressed when embedding, thus I assume in works.

Comments are closed.