开发者

How to share graphics between multiple .swf files? (Flash CS5)

In Flash CS5 it seems like there's an option to import .swc files into the library, but as an RSL (runtime shared library).

How to share graphics between multiple .swf files? (Flash CS5)

What's the difference between this option (swc) and using a runtime shared library .swf file?

Also, if you select a .swc file, and choose the "info" ("i") icon, there seems to be several options开发者_JAVA技巧 for .swc..."merged into code", "external", "runtime shared library":

How to share graphics between multiple .swf files? (Flash CS5)


An SWC is a compiled library bundled into your application's SWF when you it's built. This creates a larger application file (which takes longer to load in a browser), and means every application launch will take the same amount of time to load. If the resulting SWF is fairly large, every launch will take a while. These libraries are "statically linked" (i.e. included in the final compiled SWF).

RSLs are compiled libraries dynamically linked to your application. You build them as separate SWFs, and add them to a project as an RSL. The compiler for your application will create a link which allows your application to use it at runtime, rather than importing it into the main SWF file. When your application launches, it will attempt to locate the RSL and load the entire library dynamically. This increases the initial load of your application; once located and loaded, however, they are cached and subsequent application launches should be pretty quick.

RSLs have many benefits, and some drawbacks. Since they are not bundled into your application, your SWF is smaller and will launch more quickly. It also allows you to separate libraries in your application which would be used by other applications. Hence, "shared" library.

It also comes with a cost, however. RSLs are (by default, I think) linked by the compiler using a checksum. You cannot simply modify an RSL which is used by other applications w/out re-compiling them to account for the changes. If you modify the RSL, you'll get an error when your application launches since the checksum it expects won't match the new version of the library.


It works similar to internal and external Javascript if you allow me that comparison. The SWC option is like embedding Javascript in the host HTML file (assets from the SWC are statically linked (in)to your main SWF). The RSL option is like having an external JS file which is loaded via <script src> from an HTML file (assets from the RSL are dynamically linked to your main SWF.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜