http://livedocs.adobe.com/flex/3/html/help.html?content=rsl_02.htmlから:
「基本クラスが Sprite または MovieClip の場合、ActionScript のみのプロジェクトで RSL を使用することはできません。RSL では、Application や SimpleApplication などのアプリケーションの基本クラスが RSL の読み込みを理解する必要があります。」
私の基本クラスはスプライトだったので、このエラーが発生しました。
私の場合、次の手順を使用して、必要なすべてのクラスをアプリケーションの swf ファイルにコンパイルすることをお勧めします。
- compc を使用して、アプリケーションの swf ファイルに含めたいファイルで SWC を作成します
- インクルードする SWC ファイルを指す include-libraries で mxmlc を使用します。link-report を使用してリンク ファイル レポート (xml) を生成する
- リンクされたファイル レポート (xml) を指す load-externs を使用して、追加の各子 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>
もう 1 つの便利なヒント: fork="true" を使用すると、多くの swfs がコンパイルされているときに Java VM がメモリ不足になるのを防ぐことができます。
これが役に立てば幸いです!