js调用flash中的方法,让flash传递变量给js
来源:互联网 发布:淘宝数码回收平台 编辑:程序博客网 时间:2024/06/05 08:05
本文为 ExternalInterface 的综合应用实例,重点为“将flash变量传递给js”。此方法兼容 IE & FF .
以下为JS:
//输出测试,通过v传递flash变量
function jsAlert(v) {
alert(v);
}
//调用flash中的方法,"my_mv"为html页中swf的id
function callExternal() {
thisMovie("my_mv").flAlert();
}
//搭建js与flash互通的环境
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}else{
return document[movieName]
}
}
以下为AS:
//导入ExternalInterface类
import flash.external.ExternalInterface;
//下面这个赋值一定要注意,如果是字符串,写法应该是在双引内再加单引,此前我郁闷了一天
var i:String = "’js调用flash中的方法,传递flash变量给js’";
//var i:Number = 1234;
function showAlert(){
//调用js方法jsAlert(),并将flash变量赋值给js
ExternalInterface.call("jsAlert("+i+")");
}
//允许js中的flAlert()调用flash中的showAlert()
ExternalInterface.addCallback("flAlert",null,showAlert);
源文件下载
- js调用flash中的方法,让flash传递变量给js
- js调用flash中的方法,让flash传递变量给js
- flash调用js中的方法,让js传递变量给flash (兼容 IE & FF)
- JS调用Flash方法
- JS调用Flash和Flash调用JS
- JS调用Flash和Flash调用JS
- flash调用js函数
- flash js 互相调用
- flash调用js函数
- Flash Player 的 JS调用方法
- JS传值给flash
- js传值给flash
- JS调用flash函数,控制flash
- flash调用js的问题
- js 调用flash 接口函数
- JS与Flash相互调用
- FLASH调用网页中的JS脚本,as2适用
- Flash +js
- YAHOO.namespace
- 用SQL查询表中字段的属性2000和2005均有
- Oracle表空间文件损坏导致的数据库异常关闭并启动失败问题的解决方法
- WebForm 与 winform 路径获取
- 控制 Flash Player 的 JavaScript 方法一览表【收集纠正】
- js调用flash中的方法,让flash传递变量给js
- ASPxGaugeControl
- Oracle 监听加密
- CVS使用手册
- 在线升级Android应用程序的思路
- flash调用js中的方法,让js传递变量给flash (兼容 IE & FF)
- 最大全1子矩阵
- 发下牢骚
- MFC 拦截消息