Flex のテンプレート HTML ラッパーに細工をしてクエリ引数を flashVars へ引き継ぐには

September 4, 2009

この話は要 JavaScript です。index.template.html に細工します。

index.template.html

49行目付近

ブラウザの現在のURL引数を取得して params にセットする処理を挿入します。

// Get Parameters
var params = “”;
var pos = window.location.href.indexOf(‘?’);
if (pos == -1) {
params = “”;
} else {
params = window.location.href.substr(pos + 1);
}

94行目付近

「”flashVars”, params」を挿入します。(前の行の「,」を忘れずに。)

} else if (hasRequestedVersion) {
// if we’ve detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
“src”, “${swf}”,
“width”, “${width}”,
“height”, “${height}”,
“align”, “middle”,
“id”, “${application}”,
“quality”, “high”,
“bgcolor”, “${bgcolor}”,
“name”, “${application}”,
“allowScriptAccess”,”sameDomain”,
“type”, “application/x-shockwave-flash”,
“pluginspage”, “http://www.adobe.com/go/getflashplayer",
“flashVars”, params
);

tilfin freelance software engineer