如何在多个.swf 文件之间共享图形? (闪光CS5)
在 Flash CS5 中,似乎有一个选项可以将 .swc 文件导入到库中,但作为 RSL(运行时共享库)。
此选项 (swc) 与使用运行时共享库 .swf 文件有什么区别?
另外,如果您选择 .swc 文件,并选择“信息”(“i”)图标,则 .swc 似乎有多个选项...“合并到代码中”、“外部”、“运行时共享库” :
In Flash CS5 it seems like there's an option to import .swc files into the library, but as an RSL (runtime shared library).
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 for .swc..."merged into code", "external", "runtime shared library":
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SWC 是一个编译库,在构建应用程序时捆绑到应用程序的 SWF 中。这会创建一个更大的应用程序文件(在浏览器中加载需要更长的时间),并且意味着每个应用程序启动将花费相同的加载时间。如果生成的 SWF 相当大,则每次启动都需要一段时间。这些库是“静态链接的”(即包含在最终编译的 SWF 中)。
RSL 是动态链接到您的应用程序的已编译库。您将它们构建为单独的 SWF,并将它们作为 RSL 添加到项目中。应用程序的编译器将创建一个链接,允许应用程序在运行时使用它,而不是将其导入到主 SWF 文件中。当您的应用程序启动时,它将尝试找到 RSL 并动态加载整个库。这会增加应用程序的初始负载;然而,一旦找到并加载,它们就会被缓存,随后的应用程序启动应该很快。
RSL 有很多优点,但也有一些缺点。由于它们没有捆绑到您的应用程序中,因此您的 SWF 更小并且启动速度更快。它还允许您在应用程序中分离将由其他应用程序使用的库。因此,“共享”库。
然而,它也是有代价的。 RSL(我认为默认情况下)由编译器使用校验和链接。您不能简单地修改其他应用程序使用的 RSL,而无需重新编译它们以适应更改。如果您修改 RSL,您将在应用程序启动时收到错误消息,因为它期望的校验和与库的新版本不匹配。
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.
如果你允许我进行比较的话,它的工作原理与内部和外部 Javascript 类似。 SWC 选项就像在主机 HTML 文件中嵌入 Javascript(SWC 中的资源静态链接到主 SWF)。 RSL 选项就像拥有一个外部 JS 文件,该文件通过
从 HTML 文件加载(RSL 中的资源动态链接到您的主 SWF)。
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.