您需要通过“runtime-shared-library-path”元素上的“path-element”属性指定自定义库的SWC路径,并在“url”元素中定义指向的“rsl-url”给 SWF。请注意,每个自定义 RSL 都需要单独执行此操作。
为此,您需要解压缩 SWC 并从中提取 SWF,以便编译器可以将其复制到输出文件夹。
这里有一篇关于如何将 Mate 框架作为 RSL 包含在内的帖子的评论。我在下面添加了有趣的部分。
首先,您必须自己从 SWC 文件中提取 SWF。
<macrodef name="create-rsl">
<attribute name="rsl-dir" />
<attribute name="swc-dir" />
<attribute name="swc-name" />
<sequential>
<unzip src="@{swc-dir}/@{swc-name}.swc" dest="@{rsl-dir}" >
<patternset>
<include name="library.swf" />
</patternset>
</unzip>
<move file="@{rsl-dir}/library.swf" tofile="@{rsl-dir}/@{swc-name}.swf"/>
</sequential>
</macrodef>
<target name="extract-rsls">
<!-- Third parties RSLs -->
<create-rsl rsl-dir="${build.rsls.dir}" swc-dir="${lib.dir}" swc-name="mate" />
</target>
然后,您需要将此 SWF 文件作为 RSL:
<target name="compile">
<mxmlc file="${src.dir}/MyApplication.mxml" output="${build.dir}/MyApplication.swf" locale="${locale}" debug="false">
<!-- Flex default compile configuration -->
<load-config filename="${flex.frameworks.dir}/flex-config.xml" />
<!-- Main source path -->
<source-path path-element="${src.dir}" />
<runtime-shared-library-path path-element="${lib.dir}/mate.swc">
<url rsl-url="rsls/mate.swf" />
</runtime-shared-library-path>
</mxmlc>
</target>