Flash获取html参数的方法
生活随笔
收集整理的這篇文章主要介紹了
Flash获取html参数的方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一. swf?傳參
?
html代碼:
?代碼
<html><head>
<meta?http-equiv=”Content-Type”?content=”text/html?charset=utf-8″?/>
<title>as</title>
</head>
<body>
<object?classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″?codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0″?id=”testSWF”?width=”550″?height=”400″?title=”test”>
<param?name=”movie”?value=”test.swf?sname=xxhui”?/>
<param?name=”quality”?value=”high”?/>
<embed?src=”test.swf”?quality=”high”?pluginspage=”http://www.macromedia.com/go/getflashplayer”?type=”application/x-shockwave-flash”?width=”550″?height=”400″></embed>
</object>
</body>
</html>
?
?
Flash 代碼一: (使用_root):
?
x_txt.text?=?_root.sname;?
?
Flash 代碼二:
?代碼
String.prototype.$_GET?=?function(Parameter:String)?{return?(this.toLowerCase().split(Parameter.toLowerCase()+”=”)[1].split(”&”)[0]);
};
//獲得URL中的user參數的值
var?sname:String?=?this._url.$_GET(”sname”);
?
x_txt.text?=?sname;
?
?
二. FlashVars傳參
?
html代碼:
<param?name=”allowScriptAccess”?value=”sameDomain”?/>
<param?name=”movie”?value=”FlashVars.swf”?/>
<param?name=”flashvars”?value=”foo=happy2005&program=flash&language=簡體中文-中國”?/>
<param?name=”quality”?value=”high”?/>
<param?name=”bgcolor”?value=”#ffffff”?/>
<embed?src=”FlashVars.swf”?quality=”high”?bgcolor=”#ffffff”?width=”550″?height=”400″?name=”FlashVars”?align=”middle”?allowScriptAccess=”sameDomain”?FlashVars=”foo=happy2005&program=flash&language=簡體中文-中國”?type=”application/x-shockwave-flash”?pluginspage=”http://www.macromedia.com/go/getflashplayer”?/>
?
?
Flash代碼:
通過上面的代碼,在SWF(FlashVars.swf)中就可以直接獲取foo、program、language變量數據。FlashVars.fla獲取FlashVars參數的代碼如下:
代碼
//?創建三個文本字段_root.createTextField(”foo_txt”,1,0,0,16,16);
_root.createTextField(”program_txt”,2,0,32,16,16);
_root.createTextField(”language_txt”,3,0,64,16,16);
foo_txt.autoSize?=?true;
foo_txt.border?=?true;
program_txt.autoSize?=?true;
program_txt.border?=?true;
language_txt.autoSize?=?true;
language_txt.border?=?true;
//?獲取FlashVars變量
foo_txt.text?=?“HTML中的foo參數:”+foo;
program_txt.text?=?“HTML中的program參數:”+program;
language_txt.text?=?“HTML中的language參數:”+language;
?
?
轉載于:https://www.cnblogs.com/qiantuwuliang/archive/2010/03/30/1700620.html
總結
以上是生活随笔為你收集整理的Flash获取html参数的方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [收集]美女与野兽——萨尔和吉安娜的绯闻
- 下一篇: 交换笔记