flash 和 asp文件互相传递参数

# flash 和 asp文件互相传递参数

# asp向 flash 传

<head>
<script src="../../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head><body>
<%
outfile=trim(request("outfile"))'此参数需要传递给flash
if outfile="" then
outfile="茉莉花.mp3"'此处可以设置默认播放曲目
end if

mysearch=trim(request("search_content"))'接受flash传过来的参数
if mysearch<>"" then
response.Write("flash播放器传过来的搜索参数为:"&mysearch)
end if
%>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0','width','470','height','150','id','Flash1','align','center','src','geturl','quality','high','bgcolor','#ffffff','name','geturl','flashvars','outfile=<%=outfile%>','swliveconnect','true','allowscriptaccess','always','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','geturl' ); //end AC code
</script><noscript><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="470" height="150" id="Flash1" align="center">           
           <param name="movie" value="geturl.swf" />
           <param name="quality" value="high" />
           <param name="bgcolor" value="#ffffff" />
           <param name="FlashVars" value="outfile=<%=outfile%>" />           
           <embed src="geturl.swf" quality="high" bgcolor="#ffffff" width="470" height="150" name="geturl" FlashVars="outfile=<%=outfile%>" align="center" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
       </object></noscript>

</body>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  • flash中用如下语句接受:
if(outfile!=null && outfile!=""){
    _global.filename=outfile;
    gotoAndPlay("run");//缓冲,数据读取完全后再往下继续运行
}else{
    _global.filename="errfile";//没有传入参数时,不启动程序
}
1
2
3
4
5
6

# flash 向 asp 传

fla中: 1、先建立一个输入文本框,变量名为parm,用来输入变量值 2、建立一个按钮,加入下列代码:

on (release) {
 mysearch=new LoadVars();//建立LoadVars实例,该类即可以发送变量,又可以接受变量.
 mysearch.search_content=parm;//此处的search_content为要发送的变量名字,可以任意取,可以有多个
 //mysearch.var2="string";
 mysearch.send("test2.asp",mysearch,"get");//此处可定义用get还是post
}
1
2
3
4
5
6

asp中:

<%
search_content=trim(request("search_content"))
response.write("search_content="&search_content)
%>
1
2
3
4
上次更新: 2022/12/05, 22:29:05

Initializing...

最近更新
01
git的tag与branch 原创
05-21
02
阿里云SLS日志服务的数据脱敏及安全管理 原创
03-21
03
云平台的成本管理 原创
03-13
更多文章>
×