Flex中获取flashvars参数

Flex4中的设置方法有所改变,还是index.template.html,设置如下

<script type="text/javascript">
<!– For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. –>
var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
<!– To use express install, set to playerProductInstall.swf, otherwise the empty string. –>
var xiSwfUrlStr = "${expressInstallSwf}";
var flashvars = {};
flashvars.id= "913092672";
var params = {};
params.quality = "high";
params.bgcolor = "${bgcolor}";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "${application}";
attributes.name = "${application}";
attributes.align = "middle";
swfobject.embedSWF(
"${swf}.swf", "flashContent",
"${width}", "${height}",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
<!– JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. –>
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>

在as3中调用方式也发生了改变

FlexGlobals.topLevelApplication.parameters["id"]

或者

在object标签下加入子标签:<param name="flashvars" value="loadCompleteCallback=showImageReady"/>

你可能感兴趣的:(Flash)