新客网WWW.XKER.COM:致力做中国最专业的网络学院!
学院: 操作系统 - 网络应用 - 服务器 - 网络安全 - 工具软件 - 办公软件 - Web开发 - 数据库 - 网页设计 - 图形图像 - 媒体动画 - 硬件学堂 - 存储频道 - QQ专区
您的位置:首页 > 网络学院 > 媒体动画 > Flash教程 > 正文:JS+FLASH 参数传递 个人见解

JS+FLASH 参数传递 个人见解

新客网 XKER.COM 2008-03-17 来源:nofish s BLOG 收藏本文

HTML完整代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";'" target=&quo ... w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang= ... sp;lang="zh-CN">
<head>
<meta http-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="http://fpdownload.macromedia.com/pub/sho ... sh/swflash.cab#version=7,0,0,0" 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="http://www.macromedia.com/go/getflashplayer" />
</object>
</td>
  </tr>
</table>
<FORM METHOD=POST ACTION="">
  <div align="center"><font color="#FFFFFF">请输入:</font>  <textarea name="sendText" onkeyup="doPassVar(this)" rows="1" cols="42"></textarea>
  </div>
</FORM>
<p align="left"> <font color="ffffff" face="宋体" > </font></p>
</body>
</html>

//////////////////////  以下是网上搜集
1,先在flash的按钮上添加代码:

首页:
on (release) {
fscommand("sethomepage", ;;
}

收藏夹:
on (release) {
fscommand("addfavorite", |新客网);
}

然后在发布设置中选择flash with fscommand,发布成html

2,修改html:

找到
// handle all the the fscommand messages in a flash movie
function sethomepage_dofscommand(command, args) {
}
这一段,修改成:
// handle all the the fscommand messages in a flash movie
function sethomepage_dofscommand(command, args) {
var sethomepageobj = internetexplorer ? sethomepage : document.sethomepage;
if (command == "sethomepage") {
document.l inks[0].style.behavior = "url(#default#homepage)";
document.l inks[0].sethomepage(args);
} else if (command == "addfavorite") {
args = args.split("|");
window.external.addfavorite(args[0], args[1]);
}
}

共2页: 上一页 [1] [2] 下一页
标签:
收藏】 【评论】 【推荐】 【投稿】 【打印】 【关闭
发表评论
要记得去论坛讨论,点击注册新会员匿名评论
评论内容:不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。