为什么我的标准 RSL 没有加载?

发布于 2024-12-04 13:44:09 字数 905 浏览 2 评论 0原文

我创建了一个模块化应用程序,其中父 SWF 按需加载许多其他 SWF。为了优化,我创建了标准 RSL

我已将通用代码编译到 swc 中,并重新编译应用程序 swf 以引用此 swc,在我的 build.xml ANT 任务中使用以下内容(对于我的应用程序中的每个 swf):

<static-link-runtime-shared-libraries>false</static-link-runtime-shared-libraries>
<runtime-shared-library-path path-element="${lib.loc}/RSL.swc">
    <url rsl-url="RSL.swf"/>
</runtime-shared-library-path>

我已从 RSL.swc 中提取了 RSL.swf并将其放在我的网络服务器上与应用程序 swfs 和容器 html 文件相同的目录中。

现在,当我加载应用程序时,我收到消息:

VerifyError: Error #1014: Class mx.core:BitmapAsset could not be found.

我可以看到此类包含在 RSL.swc / RSL.swf 中的类中。

我使用 fiddler 来观察发生的情况,我可以看到我的应用程序 swf 文件已加载,但没有尝试获取 RSL.swf。

设置 Application.swf 文件以使用 RSL 后,我希望它在初始化之前尝试加载 RSL.swf,但是这并没有发生。谁能建议为什么?

I've created a modular application where a parent SWF loads a number of other SWFs on demand. For optimization, I've created a standard RSL.

I've compiled common code into a swc, and recompiled the application swfs to reference this swc, using the following in my build.xml ANT task (for each swf in my application):

<static-link-runtime-shared-libraries>false</static-link-runtime-shared-libraries>
<runtime-shared-library-path path-element="${lib.loc}/RSL.swc">
    <url rsl-url="RSL.swf"/>
</runtime-shared-library-path>

I've extracted RSL.swf from RSL.swc and put this on my webserver in the same directory as the application swfs and container html file.

Now when I load my application, I get the message:

VerifyError: Error #1014: Class mx.core:BitmapAsset could not be found.

I can see this class included in the classes in RSL.swc / RSL.swf.

I've used fiddler to observe what is happening and I can see my Application swf file is loaded, but no attempt is made to get the RSL.swf.

Having set up the Application.swf file to use RSLs, I would have expected it to attempt loading RSL.swf before initialising, however this doesn't happen. Can anyone suggest why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

っ〆星空下的拥抱 2024-12-11 13:44:09

来自 http://livedocs.adobe.com/flex/ 3/html/help.html?content=rsl_02.html

“如果基类是 Sprite 或 MovieClip,则不能在仅限 ActionScript 的项目中使用 RSL。RSL 要求应用程序的基类,例如 Application 或SimpleApplication,了解 RSL 加载。”

由于我的基类是 Sprite,所以我遇到了这个错误。

就我而言,最好使用以下步骤将所有必需的类编译到我的应用程序 swf 文件中:

  1. 使用 compc 创建一个 SWC,其中包含我想要包含在我的应用程序 swf 文件中的文件
  2. 使用 mxmlc 并包含指向的库要包含的 SWC 文件。使用 link-report 生成链接文件报告 (xml) 使用
  3. 指向链接文件报告 (xml) 的 load-extern 编译每个附加子 swf - 这会排除链接到 Application.swf 的文件被编译到每个子 swf 中

实现步骤 1:

<!-- We define the global classes which will be compiled into the parent Application   
     swf, but excluded from the tool swfs. As pure actionscript projects with base 
     class of Sprite can't usually use RSLs, we are forcing these classes to be loaded 
     into the parent application, and excluded from the child applications, allowing an 
     "Rsl-like" optimisation -->

<fileset id="rsl.inclusions" dir="${main.src.loc}">
    <include name="${main.src.loc}/path1/**/*.as"/>
    <include name="${main.src.loc}/path2/**/*.as"/>
    ...
</fileset> 

<pathconvert property="rsl.classes" pathsep=" " refid="rsl.inclusions">
<chainedmapper>
    <globmapper from="${main.src.loc}\*" to="*"/>
        <mapper type="package" from="*.as" to="*"/>
</chainedmapper> 
</pathconvert>

<!-- Compile SWC -->
<compc output="${lib.loc}/MySwc.swc" 
       include-classes="${rsl.classes}">
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>   
<source-path path-element="${main.src.loc}"/>
</compc>

实现步骤 2:

<mxmlc file="${main.src.loc}/pathToApp/Application.as" 
   output="${bin.loc}/Application.swf" 
   debug="${debug}"
   use-network="true"
   link-report="WorkbenchLinkReport.xml"
   fork="true">
    <compiler.source-path path-element="${main.src.loc}" />
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<include-libraries dir="${lib.loc}" append="true">
    <include name="MySwc.swc" />
</include-libraries>
</mxmlc> 

实现步骤 3:

<mxmlc file="${main.src.loc}/pathToChildSwf1/Child1.as"      
       output="${bin.loc}/Child1.swf" 
       debug="${debug}" 
       load-externs="WorkbenchLinkReport.xml" 
       fork="true">
<compiler.source-path path-element="${main.src.loc}" />
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<compiler.headless-server>true</compiler.headless-server>           
</mxmlc>

另一个方便的提示:使用 fork="true" 可以防止 Java VM 在编译许多 swf 时耗尽内存。

希望这有帮助!

From http://livedocs.adobe.com/flex/3/html/help.html?content=rsl_02.html:

"You cannot use RSLs in ActionScript-only projects if the base class is Sprite or MovieClip. RSLs require that the application's base class, such as Application or SimpleApplication, understand RSL loading."

As my base class was Sprite, I had this error.

In my case, it was better to compile all the required classes into my Application swf file, using the following steps:

  1. use compc to create a SWC with the files I want to include in my Application swf file
  2. use mxmlc with include-libraries pointing to the SWC file to include. Generate a linked file report (xml) using link-report
  3. compile each additional child swf with load-externs pointing to the linked file report (xml) - this excludes the files linked to the Application.swf from being compiled into each of the child swfs

To achieve step 1:

<!-- We define the global classes which will be compiled into the parent Application   
     swf, but excluded from the tool swfs. As pure actionscript projects with base 
     class of Sprite can't usually use RSLs, we are forcing these classes to be loaded 
     into the parent application, and excluded from the child applications, allowing an 
     "Rsl-like" optimisation -->

<fileset id="rsl.inclusions" dir="${main.src.loc}">
    <include name="${main.src.loc}/path1/**/*.as"/>
    <include name="${main.src.loc}/path2/**/*.as"/>
    ...
</fileset> 

<pathconvert property="rsl.classes" pathsep=" " refid="rsl.inclusions">
<chainedmapper>
    <globmapper from="${main.src.loc}\*" to="*"/>
        <mapper type="package" from="*.as" to="*"/>
</chainedmapper> 
</pathconvert>

<!-- Compile SWC -->
<compc output="${lib.loc}/MySwc.swc" 
       include-classes="${rsl.classes}">
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>   
<source-path path-element="${main.src.loc}"/>
</compc>

To achieve step 2:

<mxmlc file="${main.src.loc}/pathToApp/Application.as" 
   output="${bin.loc}/Application.swf" 
   debug="${debug}"
   use-network="true"
   link-report="WorkbenchLinkReport.xml"
   fork="true">
    <compiler.source-path path-element="${main.src.loc}" />
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<include-libraries dir="${lib.loc}" append="true">
    <include name="MySwc.swc" />
</include-libraries>
</mxmlc> 

To achieve step 3:

<mxmlc file="${main.src.loc}/pathToChildSwf1/Child1.as"      
       output="${bin.loc}/Child1.swf" 
       debug="${debug}" 
       load-externs="WorkbenchLinkReport.xml" 
       fork="true">
<compiler.source-path path-element="${main.src.loc}" />
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<compiler.headless-server>true</compiler.headless-server>           
</mxmlc>

Another handy tip: using fork="true" prevents the Java VM running out of memory where many swfs are being compiled.

Hope this is helpful!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文