次のようなPHPコードを使用してFlex4.5モジュール(SWFファイル)をロードしています。
$module = 'modules/'.$_GET['module'].'.swf';
if(!file_exists($module)) {
$module = 'error.swf';
}
$size = filesize($module);
$contents = file_get_contents($module);
header('Content-Type: application/x-shockwave-flash');
header('Accept-Ranges: bytes');
header('Content-Length: '.$size);
echo $contents;
そしてそれは非常にうまく機能します。
ここで、追加のデータを取得して、モジュールにそのデータを1つのリクエストハンドラーでロードし、次のように入力します。
private function requestHandler(response:???):void {
var data:Array = response as Array;
mySparkModuleLoader.load("", data[0] as ByteArray);
myController.load(data[1]);
}
私はAMFPHPでそれをやろうとしていましたが、ByteArrayが表示されないために壊れているか何かのようですが、残りのデータは問題ありません。
return array(
'hello world!',
new Amfphp_Core_Amf_Types_ByteArray(file_get_contents($module))
);
たぶん、http: //sun3.org/archives/107のようなマルチパート応答を作成して処理しますか?
どんなアイデアでも大歓迎です。