`

Flex3 与 Flex4 通过 FlashVar 传值的区别

    博客分类:
  • Flex
阅读更多
flex3中的做法是在html-template下修改index.template.html如下

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","id=913092672");

然后在as3中使用Application.application.parameters["id"]来调用


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"]
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics