正确获得 getFlashMovieObject

2008.11.13 01:51 [ 工作 ] 评论(1) , 阅读(1628) | |
  JS与Flash通讯早在多年以前就不是问题,但是因为微软的补丁,AS2到AS3的升级,加上一些focusFlash、swfObject的出现,再加上ExternalInterface的绑定。将Flash、JS、Flash的通讯搞的乱七八糟了。
  再加上浏览器越来越多,想要完美的支持Flash与页面通讯,已经变得比兼容CSS更麻烦了。
  Adobe自己官方的教程都不能满足ExternalInterface的正常运行。正确获得FLash Object都不能看CS3的Help了。

  function getFlashMovieObject(movieName){
    if (window.document[movieName]){
      return window.document[movieName];
    }
    if (navigator.appName.indexOf("Microsoft Internet")==-1){
      if (document.embeds && document.embeds[movieName]){
        return document.embeds[movieName];
      }
    }else{
      return document.getElementById(movieName);
    }
  }
  之前出现过:
  var isIE=(typeof window.ActiveXObject != 'undefined')?true:false;

  官方的:

  function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
      return window[movieName];
    } else {
      return document[movieName];
    }
  }
Tags:
有人在2009/04/01 22:39说:
function getFlashMovieObject(movieName){
    return document[movieName] || window[movieName]
}

足以~
tenlin 回复于 2009/04/11 15:09
时间太久了,我也忘记是否测试过这个,但Chrome和swfObject这2套折腾了很久,下次试试你这个。
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   可以直接留言
网址   电邮   [注册]