A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: [Resolved] shared libraries in swf's

  1. #1
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    Hi,
    I am not sure this is the right place to post but it was suggested by another member that people here may be able to clear this up.

    Just how do shared libraries function after publishing. At first it would seem that they would be a way to reduce movie size/download by having a central repository for common objects.

    from flash help***************
    About creating and linking shared assets

    To create a shared library that you can use with other movies, you define linkage properties for items in a movie's library. When you save the movie, the shared library is saved with the movie's FLA file.

    To use assets from a shared library in another movie, you choose File > Open As Shared Library in the current movie, and select the shared library file that you want to use. The shared library opens as a library window in the current movie. You then add assets from the shared library to the current movie's library to create links to the assets.

    You must post a shared library on the Web in order for movies that link to the shared library to display linked assets. To post a shared library on the Web, you publish the movie in which you created the shared library. This procedure posts the shared library to the URL where the movie's SWF file resides. (You can specify another location for the shared library if desired.)

    When you play a Flash movie that contains links to shared assets, the movie loads the shared library from its location on the Web and displays the shared assets as specified. The movie downloads the entire shared library file when it reaches the first frame containing a linked asset. (If the movie contains linked assets from more than one shared library, each shared library will be downloaded separately, when the first asset from that shared library occurs.)
    ************************

    does this mean that movies that share the library will have to download it each time, or will you see a performance gain in that the common swf downloads to the users machine and then is called by all movies linked to it? Meaning that I could store fonts etc in this way in my "shell movie" which then loads various external swf's which would have links to fonts etc in the shell rather than having fonts in every movie?

    seems this is confusing to many people.
    thanks mark

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    This is accomplished by the import assets and export assets tags inside a SWF file. They create an index to certain objects so that they can be reused by external files. It should allow the programmer to cut down on load times by caching SWF files. Yes, this is assuming that the computer caches the SWF, and this is a pretty good assumption in most cases.

    --Jesse

  3. #3
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    So if I understand this correctly in the flash environment, I could place all the common symbols and fonts in my "shell movie" then all external swf's that I loaded into it could access those fonts and symbols.

    This I would achieve by using "linkage" to the common library when creating those external swfs, rather than having the symbols in each fla.

    As those movies are loading into the shell, all the shared items would be cached on the users pc at that time.

    Is that about right?
    mark

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    Yep. In theory at least. ;-)

    --Jesse

  5. #5
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi Jesse,

    I have never seen this feature documented. Can you give me some pointers?

    Musicman

  6. #6
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    In flash 5 if you go to the help menu, select whats new, about half way down under a heading workflow is a link "using shared libraries"
    This gives a pretty good explanation in conjunction with the comments here.

    Dont miss the link amongst this explanation of "font symbols" which could use a little clarification if you would like to pitch in jesse
    something about addressing font symbols as objects in actionscript?

    seems almost no one talks about this and it seems a pretty important addition. I just found it by accident when I thought wouldnt it be good if you could share a library, and there it was.

    thanks again for the help.

  7. #7
    Junior Member
    Join Date
    Dec 2003
    Posts
    5

    linking in fonts from shared library

    Linking in fonts can also dramatically reduce the size of your swf files, though I have found some problems with this. I have written and article about linking fonts which can be found at http://i3t.org/members/article.jsp?articleId=1595207

  8. #8
    Senior Member
    Join Date
    Nov 2000
    Posts
    142
    maybe you guys could help clarify on a related item

    if you have an external swf with the shared objects that your main movie uses, and they are not used in the beginning movie, are they still loaded prior to the main movie playing or on demand for the object?

    The shared objects are of course linked in the library of the main movie.
    little googly goblins...

  9. #9
    Junior Member
    Join Date
    Sep 2001
    Location
    Montenegro
    Posts
    23

  10. #10
    Junior Member
    Join Date
    Mar 2004
    Location
    Mocsow
    Posts
    14
    BitSky, ILY . you've done a job, really.
    respect. hope to c u later.
    k&h

  11. #11
    Junior Member
    Join Date
    Sep 2001
    Location
    Montenegro
    Posts
    23
    wow! ILY2!

  12. #12
    Senior Member ceglia's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    262
    this is really bizarre.

    i'm exporting a bunch of fonts from my main SWF (_level0) so that they can be reused by SWFs being loaded into _level4.

    the SWFs being loaded into _level4 are composed of two frames: "hide" and "show".

    I have a preloader on _level0 that monitors the loading progress of _level4, and as soon as it detects that the _level4 SWF is fully loaded, it tells it to gotoAndStop("show").

    this all works beautifully on a broadband connection. but if i test it on a 56k connection, the SWF on _level4 never advances to the frame labeled "show".

    i believe this is happening because the shared fonts that i'm exporting in _level0 aren't really being exported or shared.

    here's what appears to be happening... even though the preloader is done preloading the _level4 SWF (i know this thanks to a trace call), the SWF does not appear on the stage until the shared fonts are pulled from the shared library on _level0, and on a 56k modem, this takes a while. and since the gotoAndStop("show") action is called as soon as the preloader is done loading, it is called prematurely, before the SWF actually appears on _level4, which is why nothing happens.

    anyone else experienced this sort of problem and know of a workaround?

    and why is this even happening?? i thought the whole point of exporting a font in the library was that it could subsequently be used in another SWF without having to reload the font.

    thanks for any tips.

  13. #13
    Junior Member
    Join Date
    Sep 2001
    Location
    Montenegro
    Posts
    23
    send me your fla and swf files.
    iv

  14. #14
    Senior Member ceglia's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    262
    BitSky, thanks a lot for your reply. I understand it would be faster if you could look at the FLAs, but I'd prefer not to send them to you, if possible.

    If you cannot help me without looking at the FLAs, I understand.

    I thought I would ask you though what settings to select for the exported font and imported font.

    Right now, I've added the font to the library for _level0, and selected "Export for Actionscript" and "Export in first frame". Should I also select "Export for runtime sharing"?

    In the _level4 SWF, I have also added the font to the library, selected "Import for runtime sharing", and specified the name of _level0 SWF in the URL field.

    The identifier I used is the same in both export and import... one word, no spaces.

    Are these settings correct?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center