加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex接收flashvars参数

发布时间:2020-12-15 04:17:32 所属栏目:百科 来源:网络整理
导读:Flex代码 ?xml version="1.0" encoding="utf-8"?!-- http://blog.flexexamples.com/2007/08/07/grabbing-flashvars-from-the-embedding-html-template/ --mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"layout="vertical"verticalAlign="middle"

Flex代码

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/08/07/grabbing-flashvars-from-the-embedding-html-template/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
				layout="vertical"
				verticalAlign="middle"
				backgroundColor="white"
				creationComplete="init()" viewSourceURL="srcview/index.html">
	
	<mx:Script>
		<!--[CDATA[
			private function init():void {
				// The FlashVars
				var obj:Object = Application.application.parameters;
				var item:String;
				
				arrColl = new ArrayCollection();
				
				/* Populate the ArrayCollection object with the FlashVars. */
				for (item in obj) {
					arrColl.addItem({key:item,value:obj[item]});
				}
				
				dataGrid.dataProvider = arrColl;
			}
		]]-->
	</mx:Script>
	
	<mx:ArrayCollection id="arrColl" />
	
	<mx:DataGrid id="dataGrid" />
	
</mx:Application>

Html代码

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<title>loaderInfoExample</title> 
</head> 
<body bgcolor="#ffffff"> 

	<div/> flashvars <div>
	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 
	codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0" 
	width="400" 
	height="250" 
	id="loaderInfoExample" 
	align="middle"> 
	<param name="allowScriptAccess" value="sameDomain" /> 
	<param name="allowFullScreen" value="false" /> 
	<PARAM NAME="flashvars" VALUE="userName=permadi"> 
	<param name="movie" value="loaderInfoExample.swf" />
	<param name="quality" value="high" />
	<param name="bgcolor" value="#ffffff" />	
	<embed src="FlashVar_Test.swf" mce_src="FlashVar_Test.swf" 
		flashvars="userName=permadi" 
		quality="high" 
		bgcolor="#ffffff" 
		width="400" 
		height="250" 
		name="loaderInfoExample" 
		align="middle" 
		allowScriptAccess="sameDomain" 
		allowFullScreen="false" 
		type="application/x-shockwave-flash" 
		pluginspage="http://www.macromedia.com/go/getflashplayer" /> 
	</object> 
</body> 
</html> 

使用javascript,如swfobject.js嵌入时

<script type="text/javascript" src="swfobject.js"></script>
        <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 = "10.0.0";
            <!-- To use express install,set to playerProductInstall.swf,otherwise the empty string. -->
            var xiSwfUrlStr = "playerProductInstall.swf";
            var FlashVars = {bridgeName:"flash"};
            var params = {};
            params.quality = "high";
            params.bgcolor = "#869ca7";
            params.allowscriptaccess = "sameDomain";
            params.allowfullscreen = "true";
            var attributes = {};
            attributes.id = "IFrameCommTest";
            attributes.name = "IFrameCommTest";
            attributes.align = "middle";
            swfobject.embedSWF(
                "IFrameCommTest.swf","flashContent","100%",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>


参考

http://blog.flexexamples.com/2007/08/07/grabbing-flashvars-from-the-embedding-html-template/

http://blog.flexexamples.com/2009/03/04/grabbing-flashvars-from-the-embedding-html-template-in-flex-gumbo-swfobject-edition/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读