Flex获取URL中的参数
来源:互联网 发布:软件数字证书认证中心 编辑:程序博客网 时间:2024/05/01 14:34
当页面通过URL来传递参数时(page.html?id=123&name=aaa),可以在包含swf的html网页中先用javascript从url中截取包含参数的字符串,以FlashVar的形式传给swf,而在Flex中可以直接使用this.parameters.参数名来获取参数的值.
Sample:
html页面代码:
<html>
<body>
<script language=javascript>
function writeflashobject(parastr) {
document.write("<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="550" height="400" id="FlashVars" align="middle"> ");
document.write("<param name="allowScriptAccess" value="sameDomain" /> ");
document.write("<param name="movie" value="useLib.swf" /> ");
document.write("<param name="FlashVars" value=""+ parastr +"" /> ");
document.write("<param name="quality" value="high" /> ");
document.write("<param name="bgcolor" value="#ffffff" /> ");
document.write("<embed src="useLib.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="FlashVars" align="middle" allowScriptAccess="sameDomain" FlashVars=""+ parastr +"" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />");
document.write("</object>");
}
function getparastr() {
var hrefstr,pos,parastr,para,tempstr1;
hrefstr = window.location.href;
pos = hrefstr.indexOf("?")
parastr = hrefstr.substring(pos+1);
return parastr;
}
var parastr = getparastr();
writeflashobject(parastr);
</script>
</body>
</html>
<body>
<script language=javascript>
function writeflashobject(parastr) {
document.write("<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="550" height="400" id="FlashVars" align="middle"> ");
document.write("<param name="allowScriptAccess" value="sameDomain" /> ");
document.write("<param name="movie" value="useLib.swf" /> ");
document.write("<param name="FlashVars" value=""+ parastr +"" /> ");
document.write("<param name="quality" value="high" /> ");
document.write("<param name="bgcolor" value="#ffffff" /> ");
document.write("<embed src="useLib.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="FlashVars" align="middle" allowScriptAccess="sameDomain" FlashVars=""+ parastr +"" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />");
document.write("</object>");
}
function getparastr() {
var hrefstr,pos,parastr,para,tempstr1;
hrefstr = window.location.href;
pos = hrefstr.indexOf("?")
parastr = hrefstr.substring(pos+1);
return parastr;
}
var parastr = getparastr();
writeflashobject(parastr);
</script>
</body>
</html>
- Flex获取URL中的参数
- Flex获取url参数
- 获取 url 中的参数
- flex获取url参数的一些写法
- Flex从页面url获取参数
- Flex获取url参数的一些写法
- Flex从页面url获取参数
- javascript 获取url中的参数
- Javascript获取URL中的参数
- Java获取URL中的参数
- JQuery获取Url中的参数
- javascript获取url中的参数
- 获取URL中的中文参数
- JS获取URL中的参数
- html获取URL中的参数
- MVC 获取url 中的参数
- js获取url中的参数
- 【转】获取URL中的 参数
- DCL Tip: Resetting File Version Numbers Lower
- .net c#中的日期比较
- javaScript技巧集合
- AskHL: Saving OpenVMS I64 EFI Console Boot Flags
- 三总选向卡的效果。。
- Flex获取URL中的参数
- sql里的cast和convert
- javascript event 事件解析
- Why is OpenVMS Secure? Worms? Viruses?
- 《C语言解惑》之 谜题1.3 逻辑操作符和增量操作符
- AskHL: Copying the LMF$LICENSE.LDB License Database?
- OpenVMS Web Browsers, Command-line Tools, and the odd RSS Feed Tool
- Virtual Machines and Hypervisors: Introduction
- JavaScript的方法和技巧