(一)IE地址栏传递法
在本页内,如何让FLASH读取到URL中的参数,经过研究得到了一下的方法!所以拿出来跟大家分享一下,AS区这个应该还不多!</p> <p> </p> <p>具体的说一下:
比如你打开一个地址:<a href="http://210.83.30.205/flash/aaa.asp?aaa=sdf">http://210.83.30.205/flash/aaa.asp?aaa=sdf</a> 这个地址页面里有一个FLASH,这个FLASH里有一个动态文本框,问题就出来了——如何让这个文本框显示地址栏中的参数(至于读取这个参数的用处我就不多说了)</p> <p>方法如下:</p> <p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="<a href=" version="7,0,0,0">http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0</a>" width="550" height="400" id="aaa" align="middle">
<param name="allowscriptAccess" value="sameDomain">
<param name="movie" value="aaa.swf?<%=" aaa="&request.querystring(">" />
<param name="quality" value="high">
<param name="bgcolor" value="#333333">
<embed src="aaa.swf" quality="high" bgcolor="#333333" width="550" height="400" name="aaa" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="<a href="></embed>http://www.macromedia.com/go/getflashplayer</a>" />
</object></p> <p>其实就是在FLASH里,把value的值该一下,如果你trace(_url)一下就知道,FLASH的地址就是<a href="http://210.83.30.205/flash/aaa.swf?aaa=sdf">http://210.83.30.205/flash/aaa.swf?aaa=sdf</a></p> <p>(二)HTML文本框传递法
步骤:
>Flash中
1.新建一个文件,保存为javascript_to_flash.fla
2.用文字工具在舞台上创建一个文本域
3.选择这个文本域,在属性面板中,从下拉列表中选择动态文本(Dynamic Text),在变量(variable)栏填上"myvar"
注意:最好的习惯是使用Instance,用myvar.text更改myvar的值.为了简单起见和兼容Flash4和Flash5,我们使用的是变量名的形式.
4.保存文件
5.发布HTML文件和SWF文件</p> <p>>Dreamweaver中
下一步的工作转移到Dreamweaver中了,当然也可以是其他的HTML编辑器
1.打开上一步发布的HTML文件
2.插入生成的SWF文件和OBJECT/EMBED标签
(1) Insert>Media>Flash,并选择这个Flash
(2) 切换到代码视图,我们需要修改被选中的<object>和<embed>标签
(3) 在OBJECT标签中,插入id="myFlash"
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="<a href=" version="7,0,0,0">http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0</a>" width="200" height="150" id="myFlash" align="middle">
注意:如果你是粘贴复制代码的话,确保删除不必要的换行.否则可能会引起错误; id也可以在属性面板里直接输入
(4) 在EMBED标签中,插入name="myFlash"和swLiveConnect="true",确保没有使用id属性!代码应当是这样子的:
<embed src="javascript_to_flash.swf" quality="high" bgcolor="#003463" width="200" height="150" swliveconnect="true" name="myFlash" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="<a href="></embed>http://www.macromedia.com/go/getflashplayer</a>" />
3.创建表单域
(1) 回到设计视图
(2) 插入文本域(Insert> Form Object> Text Field),如果询问是否添加表单域,选择是
(3) 把文本域的HTML标签修改成这样:
<input type="text" name="sendText" maxlength="45" onkeyup="doPassvar(this)">
或者选用:
<textarea name="sendText" onkeyup="doPassvar(this)" rows="1" cols="42"></textarea>
每当文本域内容发生变化时,onkeyup就被触发,doPassvar()函数就被调用
4.创建传递变量值的Javascript函数
复制下面的Javascript到<head></head>标签内
<script language="Javascript">
<!-- function doPassvar(args){ var sendText = args.value;
window.document.myFlash.Setvariable("myvar", sendText);
} file://-->
</script></p> <p>HTML完整代码:</p> <p><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd%22;-">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";'</a>" target="_blank" >http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="<a href=">http://www.w3.org/1999/xhtml</a>" xml:lang="zh-CN" lang="zh-CN">
<head>
<meta equiv="Content-Type" content="text/html; charset=gb2312">
<title>javascript_to_flash</title>
<script language="Javascript">
<!-- function doPassvar(args){ var sendText = args.value;
window.document.myFlash.Setvariable("myvar", sendText);
} file://-->
</script>
</head>
<body bgcolor="#003463">
<table width="200" border="0" align="center">
<tr>
<td>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="<a href=" version="7,0,0,0">http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0</a>" width="200" height="150" id="myFlash" align="middle">
<param name="allowscriptAccess" value="sameDomain">
<param name="movie" value="javascript_to_flash.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#003463">
<embed src="javascript_to_flash.swf" quality="high" bgcolor="#003463" width="200" height="150" swliveconnect="true" name="myFlash" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="<a href="></embed>http://www.macromedia.com/go/getflashplayer</a>" />
</object>
</td>
</tr>
</table>
<form method="POST" action="">
<div align="center"><span style="color:#FFFFFF;">请输入:</span>
<textarea name="sendText" onkeyup="doPassvar(this)" rows="1" cols="42"></textarea>
</div>
</form>
<p align="left"> <span style="font-family:宋体;color:ffffff;"> </span></p>
</body>
</html></p> <p><html>
<head>
<meta equiv="Content-Type" content="text/html; charset=gb2312">
<title>javascript_to_flash</title>
<script language="Javascript"> function doPassvar(args){ var sendText = args.value;
window.document.myFlash.Setvariable("myvar", sendText);
}</p> <p>function goto() {
n++;
document.myFlash.GotoFrame(n);
}</p> <p></script>
</head>
<body bgcolor="#003463">
<table width="200" border="0" align="center">
<tr>
<td>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="<a href=" version="7,0,0,0">http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0</a>" width="200" height="150" id="myFlash" align="middle">
<param name="allowscriptAccess" value="sameDomain">
<param name="movie" value="javascript_to_flash.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#003463">
<embed src="javascript_to_flash.swf" quality="high" bgcolor="#003463" width="200" height="150" swliveconnect="true" name="myFlash" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="<a href="></embed>http://www.macromedia.com/go/getflashplayer</a>" />
</object>
</td>
</tr>
</table>
<form method="POST" action="">
<div align="center"><span style="color:#FFFFFF;">请输入:</span>
<textarea name="sendText" onkeyup="doPassvar(this)" rows="1" cols="42"></textarea>
<input type="button" value="next" onclick="goto()">
</div>
</form>
<p align="left"> <span style="font-family:宋体;color:ffffff;"> </span></p>
</body>
</html></p></div>
This blogger is recording some code samples,technical skill of java,.Net,javascript, css, html for myself use. All articles are coming from my own experience and my collections which are from internet world. If you find any material have copy right issue please leave a comment to me. I will delete it immediately. These articles are writing in English or Chinese. Hope these information can help other technical guys. Thanks for reading.
Subscribe to:
Post Comments (Atom)
-
If you get "This page calls for XML namespace http://richfaces.org/a4j declared with prefix a4j but no taglibrary exists for that names...
-
Method 1: import oracle.sql.*; public class JClob { String tableName = null; // String primaryKey = null; // String primaryValue = null; // ...
-
1.HTTP-binding(ServiceMix) 1.4 各组件间传递消息流的过程如下: 1. HttpClient : Http 客户端运行一个独立的 Java 客户端程序,通过其中的 URLConnection 类连接到 http://...
No comments:
Post a Comment